diff --git a/.changeset/chatty-roses-itch.md b/.changeset/chatty-roses-itch.md new file mode 100644 index 000000000..0940ee35d --- /dev/null +++ b/.changeset/chatty-roses-itch.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/edr": patch +--- + +fix: ignore unknown opcodes in source maps diff --git a/crates/edr_solidity/src/source_map.rs b/crates/edr_solidity/src/source_map.rs index 8346f2d00..1b2ddaa57 100644 --- a/crates/edr_solidity/src/source_map.rs +++ b/crates/edr_solidity/src/source_map.rs @@ -159,7 +159,10 @@ pub fn decode_instructions( let source_map = &source_maps[instructions.len()]; let pc = bytes_index; - let opcode = OpCode::new(bytecode[pc]).expect("Invalid opcode"); + let opcode = match OpCode::new(bytecode[pc]) { + Some(opcode) => opcode, + None => continue, + }; let push_data = if opcode.is_push() { let push_data = &bytecode[bytes_index..][..1 + opcode.info().immediate_size() as usize];