mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-22 06:34:32 +00:00
common/bitutil: improve the fuzzers (#21829)
This commit is contained in:
parent
a5531a2470
commit
96f5876896
1 changed files with 3 additions and 3 deletions
|
|
@ -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:])
|
||||
|
|
@ -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
|
||||
|
|
@ -52,5 +52,5 @@ func fuzzDecode(data []byte) int {
|
|||
if comp := bitsetEncodeBytes(blob); !bytes.Equal(comp, data) {
|
||||
panic("content mismatch")
|
||||
}
|
||||
return 0
|
||||
return 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue