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
This contract causes an access violation in Solana's mock VM, because fun is a null pointer.
fun
contract C { function test(uint256 newAddress, bytes4 newSelector) public view returns (bytes4, address) { function() external fun; address myAddr = address(newAddress); assembly { fun.selector := myAddr fun.address := newAddress } return (fun.selector, fun.address); } }
The text was updated successfully, but these errors were encountered:
This won't even compile with solc:
solc
Error: Explicit type conversion not allowed from "uint256" to "address". --> bug.sol:7:26: | 7 | address myAddr = address(newAddress); | ^^^^^^^^^^^^^^^^^^^
Sorry, something went wrong.
This won't even compile with solc: Error: Explicit type conversion not allowed from "uint256" to "address". --> bug.sol:7:26: | 7 | address myAddr = address(newAddress); | ^^^^^^^^^^^^^^^^^^^
That's because an address is 20 bytes on ethereum. I think this will work:
contract C { function test(uint160 newAddress, bytes4 newSelector) public view returns (bytes4, address) { function() external fun; address myAddr = address(newAddress); assembly { fun.selector := myAddr fun.address := newAddress } return (fun.selector, fun.address); } }
Of course, maybe next time I should read the contract first
No branches or pull requests
This contract causes an access violation in Solana's mock VM, because
fun
is a null pointer.The text was updated successfully, but these errors were encountered: