We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assigning a value to a bytes variable using assembly results in an abnormal return value.
By commenting out pragma abicoder v1;, you manually enable or disable ABICoder v1.
// pragma abicoder v1; contract Combined { function complexFunction() public pure returns (bytes memory, uint, bytes20[] memory, uint) { (bytes memory a, uint b, bytes20[] memory c, uint d) = simplifiedFunction(); // manipulate memory outputs assembly { let ptr := mload(0x40) a := ptr } // optional loop and manipulation for (uint i = 0; i < c.length; i++) { if (i == 2) { continue; } c[i] = bytes20(uint160(c[i]) ^ 0xFFFF); } return (a, b, c, d); } function simplifiedFunction() internal pure returns (bytes memory a, uint b, bytes20[] memory c, uint d) { a = "ESCAPE\\SEQUENCE\\TEST"; b = type(uint).max; c = new bytes20[](4); c[0] = bytes20(uint160(1234)); c[3] = bytes20(uint160(6789)); d = 0x1234; } }
{ "0": "bytes: 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080", "1": "uint256: 115792089237316195423570985008687907853269984665640564039457584007913129639935", "2": "bytes20[]: 0x000000000000000000000000000000000000fb2d,0x000000000000000000000000000000000000ffff,0x0000000000000000000000000000000000000000,0x000000000000000000000000000000000000e57a", "3": "uint256: 4660" }
{ "0": "bytes: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012340000000000000000000000000000000000000000000000000000000000000080", "1": "uint256: 115792089237316195423570985008687907853269984665640564039457584007913129639935", "2": "bytes20[]: 0x000000000000000000000000000000000000fb2d,0x000000000000000000000000000000000000ffff,0x0000000000000000000000000000000000000000,0x000000000000000000000000000000000000e57a", "3": "uint256: 4660" }
The result of the first return value is abnormal. Why do fff and 1234 appear?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Assigning a value to a bytes variable using assembly results in an abnormal return value.
Environment
Steps to Reproduce
By commenting out pragma abicoder v1;, you manually enable or disable ABICoder v1.
Not use ABICoder v1
use ABICoder v1
The result of the first return value is abnormal. Why do fff and 1234 appear?
The text was updated successfully, but these errors were encountered: