From fec9fcaf9727919f01a7ea24999562fb8809468d Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Mon, 6 Jan 2025 16:40:53 +0100 Subject: [PATCH] fix: ignore unknown opcodes in source maps --- crates/edr_solidity/src/source_map.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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];