Skip to content

Commit bbe8511

Browse files
committed
fix boundary condition check in PUSH32
1 parent c0d093b commit bbe8511

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/vm/instructions.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,10 @@ func makePush(size uint64, pushByteSize int) executionFunc {
964964
interpreter.evm.TxContext.Accesses.TouchAddressAndChargeGas(index, nil)
965965

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

0 commit comments

Comments
 (0)