tests/fuzzers: improve the fuzzers (#21829)

* tests/fuzzers, common/bitutil: make fuzzers use correct returnvalues + remove output

* tests/fuzzers/stacktrie: fix duplicate-key insertion in stacktrie (false positive)

* tests/fuzzers/stacktrie: fix compilation error

* tests/fuzzers: linter nits
This commit is contained in:
Martin Holst Swende
2020-11-13 12:36:38 +01:00
committed by GitHub
parent 9ded4e33c5
commit 0703c91fba
5 changed files with 33 additions and 20 deletions

View File

@ -37,17 +37,17 @@ func decodeEncode(input []byte, val interface{}, i int) {
}
func Fuzz(input []byte) int {
if len(input) == 0 {
return 0
}
var i int
{
if len(input) > 0 {
rlp.Split(input)
}
rlp.Split(input)
}
{
if len(input) > 0 {
if elems, _, err := rlp.SplitList(input); err == nil {
rlp.CountValues(elems)
}
if elems, _, err := rlp.SplitList(input); err == nil {
rlp.CountValues(elems)
}
}
@ -123,5 +123,5 @@ func Fuzz(input []byte) int {
var rs types.Receipts
decodeEncode(input, &rs, i)
}
return 0
return 1
}