Skip to content

Commit 07633c8

Browse files
authored
execution retval length check (#4802)
1 parent e6ae103 commit 07633c8

File tree

1 file changed

+1
-1
lines changed
  • action/protocol/execution/evm

1 file changed

+1
-1
lines changed

action/protocol/execution/evm/evm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func ExecuteContract(
371371
}
372372
stateDB.clear()
373373

374-
if ps.featureCtx.SetRevertMessageToReceipt && receipt.Status == uint64(iotextypes.ReceiptStatus_ErrExecutionReverted) && retval != nil && bytes.Equal(retval[:4], _revertSelector) {
374+
if ps.featureCtx.SetRevertMessageToReceipt && receipt.Status == uint64(iotextypes.ReceiptStatus_ErrExecutionReverted) && len(retval) >= 4 && bytes.Equal(retval[:4], _revertSelector) {
375375
// in case of the execution revert error, parse the retVal and add to receipt
376376
receipt.SetExecutionRevertMsg(ExtractRevertMessage(retval))
377377
}

0 commit comments

Comments
 (0)