Skip to content

Commit 479589d

Browse files
MariusVanDerWijdenbulgakovk
authored andcommitted
tests/fuzzers/abi: fixed one-off panic with int.Min64 value (ethereum#22233)
* tests/fuzzers/abi: fixed one-off panic with int.Min64 value * tests/fuzzers/abi: fixed one-off panic with int.Min64 value
1 parent 45d543c commit 479589d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tests/fuzzers/abi/abifuzzer.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ func getUInt(fuzzer *fuzz.Fuzzer) int {
161161
var i int
162162
fuzzer.Fuzz(&i)
163163
if i < 0 {
164-
i *= -1
164+
i = -i
165+
if i < 0 {
166+
return 0
167+
}
165168
}
166169
return i
167170
}

tests/fuzzers/abi/abifuzzer_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import (
2323
// TestReplicate can be used to replicate crashers from the fuzzing tests.
2424
// Just replace testString with the data in .quoted
2525
func TestReplicate(t *testing.T) {
26-
testString := "N\xef\xbf0\xef\xbf99000000000000" +
27-
"000000000000"
28-
26+
testString := "\x20\x20\x20\x20\x20\x20\x20\x20\x80\x00\x00\x00\x20\x20\x20\x20\x00"
2927
data := []byte(testString)
3028
runFuzzer(data)
3129
}

0 commit comments

Comments
 (0)