Skip to content

Commit

Permalink
fix boundary condition check in PUSH32
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Nov 26, 2021
1 parent 6d40e11 commit 03dbc0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,10 @@ func makePush(size uint64, pushByteSize int) executionFunc {
interpreter.evm.TxContext.Accesses.TouchAddressAndChargeGas(index, nil)

// in the case of PUSH32, the end data might be two chunks away,
// so also get the middle chunk.
if pushByteSize == 32 {
// so also get the middle chunk. There is a boundary condition
// check (endMin > 2) in the case the code is a single PUSH32
// insctruction, whose immediate are just 0s.
if pushByteSize == 32 && endMin > 2 {
chunk = uint64(endMin-2) / 31
count = uint64(0)
// Look for the first code byte (i.e. no pushdata)
Expand Down

0 comments on commit 03dbc0a

Please sign in to comment.