Skip to content

Commit

Permalink
common/bitutil: improve the fuzzers (ethereum#21829)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Sep 18, 2024
1 parent c6744e1 commit e0e7342
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/bitutil/compress_fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import "bytes"
// invocations.
func Fuzz(data []byte) int {
if len(data) == 0 {
return -1
return 0
}
if data[0]%2 == 0 {
return fuzzEncode(data[1:])
Expand All @@ -39,7 +39,7 @@ func fuzzEncode(data []byte) int {
if !bytes.Equal(data, proc) {
panic("content mismatch")
}
return 0
return 1
}

// fuzzDecode implements a go-fuzz fuzzer method to test the bit decoding and
Expand All @@ -52,5 +52,5 @@ func fuzzDecode(data []byte) int {
if comp := bitsetEncodeBytes(blob); !bytes.Equal(comp, data) {
panic("content mismatch")
}
return 0
return 1
}

0 comments on commit e0e7342

Please sign in to comment.