diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 2a4b097af4..83e1f68552 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -585,6 +585,10 @@ var ( // runBn256Pairing implements the Bn256Pairing precompile, referenced by both // Byzantium and Istanbul operations. func runBn256Pairing(input []byte) ([]byte, error) { + // Allow at most 4 inputs + if len(input) > 4*192 { + return nil, errBadPairingInput + } // Handle some corner cases cheaply if len(input)%192 > 0 { return nil, errBadPairingInput diff --git a/core/vm/testdata/precompiles/bn256Pairing.json b/core/vm/testdata/precompiles/fail-bn256Pairing.json similarity index 100% rename from core/vm/testdata/precompiles/bn256Pairing.json rename to core/vm/testdata/precompiles/fail-bn256Pairing.json