diff --git a/ethereum/referencetests/src/reference-test/external-resources b/ethereum/referencetests/src/reference-test/external-resources index 69c4c2a98dc..638da7ca7b2 160000 --- a/ethereum/referencetests/src/reference-test/external-resources +++ b/ethereum/referencetests/src/reference-test/external-resources @@ -1 +1 @@ -Subproject commit 69c4c2a98dc8a712d4c6f5a817da4f21ff719006 +Subproject commit 638da7ca7b2ca371ebb33d7d7d2562981aafd9b2 diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java index ca28eecdb62..a2ebcf472df 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCreateOperation.java @@ -80,6 +80,12 @@ public OperationResult execute(final MessageFrame frame, final EVM evm) { final MutableAccount account = frame.getWorldUpdater().getAccount(address).getMutable(); frame.clearReturnData(); + final long inputOffset = clampedToLong(frame.getStackItem(1)); + final long inputSize = clampedToLong(frame.getStackItem(2)); + if (inputSize > maxInitcodeSize) { + frame.popStackItems(getStackItemsConsumed()); + return new OperationResult(cost, ExceptionalHaltReason.CODE_TOO_LARGE); + } if (value.compareTo(account.getBalance()) > 0 || frame.getMessageStackDepth() >= 1024 @@ -88,12 +94,6 @@ public OperationResult execute(final MessageFrame frame, final EVM evm) { } else { account.incrementNonce(); - final long inputOffset = clampedToLong(frame.getStackItem(1)); - final long inputSize = clampedToLong(frame.getStackItem(2)); - if (inputSize > maxInitcodeSize) { - frame.popStackItems(getStackItemsConsumed()); - return new OperationResult(cost, ExceptionalHaltReason.CODE_TOO_LARGE); - } final Bytes inputData = frame.readMemory(inputOffset, inputSize); // Never cache CREATEx initcode. The amount of reuse is very low, and caching mostly // addresses disk loading delay, and we already have the code.