Skip to content

Commit a9b13a3

Browse files
committed
Add workaround for address on stack
1 parent 0f35494 commit a9b13a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

zero_bin/rpc/src/native/txn.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,14 @@ pub fn generate_jumpdest_table(
517517
callee_raw_opt.is_some(),
518518
"Stack must contain at least two values for a CALL instruction."
519519
);
520+
521+
// Clear the upper half of the operand.
520522
let callee_raw = *callee_raw_opt.unwrap();
523+
let (callee_raw, _overflow) = callee_raw.overflowing_shl(128);
524+
let (callee_raw, _overflow) = callee_raw.overflowing_shr(128);
521525

522-
let lower_bytes = U160::from(callee_raw);
523-
Address::from(lower_bytes)
526+
let lower_20_bytes = U160::from(callee_raw);
527+
Address::from(lower_20_bytes)
524528
};
525529

526530
if precompiles().contains(&callee_address) {

0 commit comments

Comments
 (0)