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
This commit is contained in:
Marius van der Wijden 2021-01-25 21:40:14 +01:00 committed by GitHub
parent d2779ed7ac
commit 7202b410b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -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
}

View File

@ -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)
}