Skip to content

Commit b0537f6

Browse files
author
Andreas Auernhammer
committed
fuzz: prefer longer inputs
In general, the fuzzer does minimizes test cases. Therefore, the fuzzing code barely sees long inputs. Consequently, we have to tell the fuzzer that we like long input values.
1 parent 4fa7777 commit b0537f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fuzz.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func init() {
6161
wStream = NewStream(c20p1305, BufSize)
6262
}
6363

64+
var maxDataLen int
65+
6466
func FuzzAll(data []byte) int {
6567
v := FuzzReader(data)
6668
v += FuzzReadByte(data)
@@ -69,6 +71,11 @@ func FuzzAll(data []byte) int {
6971
v += FuzzWrite(data)
7072
v += FuzzWriteByte(data)
7173
v += FuzzReadFrom(data)
74+
75+
if len(data) > maxDataLen { // Prefer longer inputs
76+
maxDataLen = len(data)
77+
v += 1
78+
}
7279
return v
7380
}
7481

0 commit comments

Comments
 (0)