From a5478cab0787571e713d0d4549021740036658ea Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 26 Mar 2024 20:27:53 +0100 Subject: [PATCH] core/vm: also apply to old create --- core/vm/gas_table.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index 1e3a0fca94..75fcea7f32 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -311,9 +311,12 @@ func gasCreateEip3860(evm *EVM, contract *Contract, stack *Stack, mem *Memory, m return 0, err } size, overflow := stack.Back(2).Uint64WithOverflow() - if overflow || size > params.MaxInitCodeSize { + if overflow { return 0, ErrGasUintOverflow } + if size > params.MaxInitCodeSize { + return 0, fmt.Errorf("%w: size %d", ErrMaxInitCodeSizeExceeded, size) + } // Since size <= params.MaxInitCodeSize, these multiplication cannot overflow moreGas := params.InitCodeWordGas * ((size + 31) / 32) if gas, overflow = math.SafeAdd(gas, moreGas); overflow {