ReturnDataLoad is an EOF only operation (#7670)

Update ReturnDataLoadOperation to fail when called from legacy.

Signed-off-by: Danno Ferrin <danno@numisight.com>
pull/7745/head
Danno Ferrin 2 months ago committed by GitHub
parent 8cf20ed7f5
commit 63b9ec9daa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      evm/src/main/java/org/hyperledger/besu/evm/operation/ReturnDataLoadOperation.java

@ -16,6 +16,7 @@ package org.hyperledger.besu.evm.operation;
import static org.hyperledger.besu.evm.internal.Words.clampedToInt; import static org.hyperledger.besu.evm.internal.Words.clampedToInt;
import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.EVM; import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.frame.MessageFrame; import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator; import org.hyperledger.besu.evm.gascalculator.GasCalculator;
@ -37,6 +38,11 @@ public class ReturnDataLoadOperation extends AbstractOperation {
@Override @Override
public OperationResult execute(final MessageFrame frame, final EVM evm) { public OperationResult execute(final MessageFrame frame, final EVM evm) {
Code code = frame.getCode();
if (code.getEofVersion() == 0) {
return InvalidOperation.INVALID_RESULT;
}
final int offset = clampedToInt(frame.popStackItem()); final int offset = clampedToInt(frame.popStackItem());
Bytes returnData = frame.getReturnData(); Bytes returnData = frame.getReturnData();
int retunDataSize = returnData.size(); int retunDataSize = returnData.size();

Loading…
Cancel
Save