diff --git a/frame/evm/precompile/bn128/src/lib.rs b/frame/evm/precompile/bn128/src/lib.rs index b620da7480..4b8cfd74d2 100644 --- a/frame/evm/precompile/bn128/src/lib.rs +++ b/frame/evm/precompile/bn128/src/lib.rs @@ -173,6 +173,12 @@ impl Precompile for Bn128Pairing { handle.record_cost(Bn128Pairing::BASE_GAS_COST)?; U256::one() } else { + if handle.input().len() % 192 > 0 { + return Err(PrecompileFailure::Error { + exit_status: ExitError::Other("bad elliptic curve pairing size".into()), + }); + } + // (a, b_a, b_b - each 64-byte affine coordinates) let elements = handle.input().len() / 192;