From 7202b410b064c17c0648c4c6c212dc4c2a787907 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Mon, 25 Jan 2021 21:40:14 +0100 Subject: [PATCH] tests/fuzzers/abi: fixed one-off panic with int.Min64 value (#22233) * tests/fuzzers/abi: fixed one-off panic with int.Min64 value * tests/fuzzers/abi: fixed one-off panic with int.Min64 value --- tests/fuzzers/abi/abifuzzer.go | 5 ++++- tests/fuzzers/abi/abifuzzer_test.go | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/fuzzers/abi/abifuzzer.go b/tests/fuzzers/abi/abifuzzer.go index 8c083b371..60233d158 100644 --- a/tests/fuzzers/abi/abifuzzer.go +++ b/tests/fuzzers/abi/abifuzzer.go @@ -161,7 +161,10 @@ func getUInt(fuzzer *fuzz.Fuzzer) int { var i int fuzzer.Fuzz(&i) if i < 0 { - i *= -1 + i = -i + if i < 0 { + return 0 + } } return i } diff --git a/tests/fuzzers/abi/abifuzzer_test.go b/tests/fuzzers/abi/abifuzzer_test.go index c59c45ab1..423a3cd23 100644 --- a/tests/fuzzers/abi/abifuzzer_test.go +++ b/tests/fuzzers/abi/abifuzzer_test.go @@ -23,9 +23,7 @@ import ( // TestReplicate can be used to replicate crashers from the fuzzing tests. // Just replace testString with the data in .quoted func TestReplicate(t *testing.T) { - testString := "N\xef\xbf0\xef\xbf99000000000000" + - "000000000000" - + testString := "\x20\x20\x20\x20\x20\x20\x20\x20\x80\x00\x00\x00\x20\x20\x20\x20\x00" data := []byte(testString) runFuzzer(data) }