Skip to content

Commit f0aa336

Browse files
only write headers with a length that fits into 2 bytes in fuzz test
1 parent 287a324 commit f0aa336

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fuzzing/header/fuzz.go

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func Fuzz(data []byte) int {
4848
return 0
4949
}
5050
}
51+
// We always use a 2-byte encoding for the Length field in Long Header packets.
52+
// Serializing the header will fail when using a higher value.
53+
if hdr.IsLongHeader && hdr.Length > 16383 {
54+
return 1
55+
}
5156
b := &bytes.Buffer{}
5257
if err := extHdr.Write(b, version); err != nil {
5358
// We are able to parse packets with connection IDs longer than 20 bytes,

0 commit comments

Comments
 (0)