Skip to content

Commit

Permalink
Replace multiple overflow for 2 single overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Aug 29, 2024
1 parent ad1e065 commit f6b77f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion system-contracts/contracts/EvmInterpreterLoop.template.yul
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ for { } true { } {
size, sp := popStackItemWithoutCheck(sp)

checkOverflow(destOffset, size, evmGasLeft)
checkMultipleOverflow(offset, size, MEM_OFFSET_INNER(), evmGasLeft)
checkOverflow(offset, size, evmGasLeft)
checkOverflow(add(offset, size), MEM_OFFSET_INNER(), evmGasLeft)
checkMemOverflowByOffset(add(destOffset,size), evmGasLeft)

if gt(add(add(offset, size), MEM_OFFSET_INNER()), MAX_MEMORY_FRAME()) {
Expand Down
6 changes: 4 additions & 2 deletions system-contracts/contracts/EvmInterpreterPreprocessed.yul
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,8 @@ object "EVMInterpreter" {
size, sp := popStackItemWithoutCheck(sp)

checkOverflow(destOffset, size, evmGasLeft)
checkMultipleOverflow(offset, size, MEM_OFFSET_INNER(), evmGasLeft)
checkOverflow(offset, size, evmGasLeft)
checkOverflow(add(offset, size), MEM_OFFSET_INNER(), evmGasLeft)
checkMemOverflowByOffset(add(destOffset,size), evmGasLeft)

if gt(add(add(offset, size), MEM_OFFSET_INNER()), MAX_MEMORY_FRAME()) {
Expand Down Expand Up @@ -4905,7 +4906,8 @@ object "EVMInterpreter" {
size, sp := popStackItemWithoutCheck(sp)

checkOverflow(destOffset, size, evmGasLeft)
checkMultipleOverflow(offset, size, MEM_OFFSET_INNER(), evmGasLeft)
checkOverflow(offset, size, evmGasLeft)
checkOverflow(add(offset, size), MEM_OFFSET_INNER(), evmGasLeft)
checkMemOverflowByOffset(add(destOffset,size), evmGasLeft)

if gt(add(add(offset, size), MEM_OFFSET_INNER()), MAX_MEMORY_FRAME()) {
Expand Down

0 comments on commit f6b77f3

Please sign in to comment.