You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[test]fntest_end_of_range_swap(){letmut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[58,50,50,51,57]));letmut current_call_frame = vm.call_frames.pop().unwrap();
vm.execute(&mut current_call_frame);}
Backtrace
---- tests::test_end_of_range_swap stdout ----
thread 'tests::test_end_of_range_swap' panicked at /home/.../.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.8.0/src/bytes.rs:305:9:
range end out of bounds:200 <= 5
stack backtrace:0: rust_begin_unwind
at /rustc/59e2c01c2217a01546222e4d9ff4e6695ee8a1db/library/std/src/panicking.rs:658:51: core::panicking::panic_fmt
at /rustc/59e2c01c2217a01546222e4d9ff4e6695ee8a1db/library/core/src/panicking.rs:74:142: bytes::bytes::Bytes::slice
at /home/mhoste/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bytes-1.8.0/src/bytes.rs:305:93: ethereum_rust_levm::opcode_handlers::environment::<impl ethereum_rust_levm::vm::VM>::op_codecopy
at ./src/opcode_handlers/environment.rs:238:204: ethereum_rust_levm::vm::VM::execute
at ./src/vm.rs:236:375: lib::tests::test_end_of_range_swap
at ./tests/tests.rs:89:56: lib::tests::test_end_of_range_swap::{{closure}}
at ./tests/tests.rs:86:287: core::ops::function::FnOnce::call_once
at /rustc/59e2c01c2217a01546222e4d9ff4e6695ee8a1db/library/core/src/ops/function.rs:250:58: core::ops::function::FnOnce::call_once
at /rustc/59e2c01c2217a01546222e4d9ff4e6695ee8a1db/library/core/src/ops/function.rs:250:5
The text was updated successfully, but these errors were encountered:
Our team (@FuzzingLabs) discovered a bug in the op_codecopy function, which lead to a range end out of bounds.
Root cause
let code = current_call_frame.bytecode.slice(offset..offset + size);
Because of the lack of checks, we can trigger a range end out of bounds.Step to reproduce
Payload
Add to [test](https://github.com/lambdaclass/lambda_ethereum_rust/blob/main/crates/vm/levm/tests/tests.rs) :
Backtrace
The text was updated successfully, but these errors were encountered: