Skip to content

Commit

Permalink
Prevent overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Aug 4, 2023
1 parent ea7a39d commit ac8d163
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion evm/src/witness/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,11 @@ fn append_shift<F: Field>(
}

// Convert the shift, and log the corresponding arithmetic operation.
let input0 = U256::from(2).pow(input0);
let input0 = if input0 > U256::from(255u64) {
U256::zero()
} else {
U256::from(2).pow(input0)
};
let operator = if row.op.shl.is_one() {
BinaryOperator::Mul
} else {
Expand Down

0 comments on commit ac8d163

Please sign in to comment.