Skip to content

Commit a54b100

Browse files
Echo8377qmonnet
authored andcommitted
Fix: address review comments
Signed-off-by: Echo8377 <3307430557@qq.com>
1 parent 174492f commit a54b100

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

‎src/interpreter.rs‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -427,25 +427,7 @@ pub fn execute_program(
427427
// that read or write to the stack, check_mem_load or check_mem_store will return an error.
428428
reg[10] -= stacks[stack_frame_idx].get_stack_usage().stack_usage() as u64;
429429
stack_frame_idx += 1;
430-
// Use checked arithmetic to prevent integer overflow
431-
let offset = insn.imm as isize;
432-
if offset < 0 {
433-
let abs_offset = (-offset) as usize;
434-
if abs_offset > insn_ptr {
435-
Err(Error::other(format!(
436-
"Error: call offset underflow (insn #{})",
437-
insn_ptr - 1
438-
)))?;
439-
}
440-
insn_ptr -= abs_offset;
441-
} else {
442-
insn_ptr = insn_ptr.checked_add(offset as usize).ok_or_else(|| {
443-
Error::other(format!(
444-
"Error: call offset overflow (insn #{})",
445-
insn_ptr - 1
446-
))
447-
})?;
448-
}
430+
insn_ptr += insn.imm as usize;
449431
}
450432
_ => {
451433
Err(Error::other(

0 commit comments

Comments
 (0)