diff --git a/core/vm/contracts.go b/core/vm/contracts.go index cae0be9f2de..03cf5d25b73 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -591,8 +591,11 @@ func (c *bigModExp) RequiredGas(input []byte) uint64 { if expLen > 32 { expHead.SetBytes(getData(input, baseLen, 32)) } else { - // TODO: Check that if expLen < baseLen, then getData will return an empty slice - expHead.SetBytes(getData(input, baseLen, expLen)) + if expLen < baseLen && uint64(len(input)) < baseLen+expLen { + expHead.SetBytes([]byte{}) + } else { + expHead.SetBytes(getData(input, baseLen, expLen)) + } } }