From ddc5e618a752fdeec51fca50620df4c007843636 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Fri, 29 Nov 2024 16:08:31 +0800 Subject: [PATCH] crypto/bn256: fix bn256Mul fuzzer to not hang on large input (#21872) * crypto/bn256: fix bn256Mul fuzzer to not hang on large input * Update crypto/bn256/bn256_fuzz.go Co-authored-by: ligi Co-authored-by: ligi --- tests/fuzzers/bn256/bn256_fuzz.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/fuzzers/bn256/bn256_fuzz.go b/tests/fuzzers/bn256/bn256_fuzz.go index d735745185..91ff35daaa 100644 --- a/tests/fuzzers/bn256/bn256_fuzz.go +++ b/tests/fuzzers/bn256/bn256_fuzz.go @@ -90,6 +90,12 @@ func FuzzMul(data []byte) int { if remaining == 0 { return 0 } + if remaining > 128 { + // The evm only ever uses 32 byte integers, we need to cap this otherwise + // we run into slow exec. A 236Kb byte integer cause oss-fuzz to report it as slow. + // 128 bytes should be fine though + return 0 + } buf := make([]byte, remaining) input.Read(buf)