Skip to content
New issue

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

Undefined index access succeeded. #1736

Open
Subway2023 opened this issue Feb 10, 2025 · 0 comments
Open

Undefined index access succeeded. #1736

Subway2023 opened this issue Feb 10, 2025 · 0 comments

Comments

@Subway2023
Copy link

Version: v0.3.3: Atlantis
Description: The array arr is not initialized, yet when accessing arr[1], the program executes successfully. However, if this code is run in solc+EVM, it will throw an error.

contract c {
    bytes arr;
    function f() public { bytes1 a = arr[1];}
}

Reproduction: I set up a Solang compilation and execution environment to test the program.

solang/target/debug/vmRunNoPara test.sol c f

The program executes normally.

Contract name: c
function new for 7QL9j5bBcStG2Nx2nx4m7br2HerAAwkxSaJK1RWch2QS
input: 872ccdc6190148bc
running bpf with calldata:872ccdc6190148bc
program: 7QL9j5bBcStG2Nx2nx4m7br2HerAAwkxSaJK1RWch2QS
static: length:8 0000000000000000
offset:28 prev:10 next:10 length:0 allocated:0 
function f for 7QL9j5bBcStG2Nx2nx4m7br2HerAAwkxSaJK1RWch2QS
input: 352dd00eb9a6751b
running bpf with calldata:352dd00eb9a6751b
program: 7QL9j5bBcStG2Nx2nx4m7br2HerAAwkxSaJK1RWch2QS
sol_set_return_data: 
static: length:8 0000000000000000
offset:28 prev:10 next:1

Execute in remix

Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant