mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-20 05:48:59 +00:00
mess around with benchmarks and fuzzing
This commit is contained in:
@@ -210,3 +210,31 @@ func TestBadOSCBundleDecoding(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func FuzzBundleFromBytes(f *testing.F) {
|
||||
seedBytes := [][]byte{
|
||||
{},
|
||||
{35, 98, 117, 110, 100, 108, 101, 0, 0, 0, 0,
|
||||
32, 0, 0, 0, 0, 0, 0, 0, 32, 47, 111,
|
||||
115, 99, 105, 108, 108, 97, 116, 111, 114, 47, 52,
|
||||
47, 102, 114, 101, 113, 117, 101, 110, 99, 121, 0,
|
||||
44, 102, 0, 0, 67, 220, 0, 0},
|
||||
{35, 98, 117, 110, 100, 108, 101, 0, // #bundle
|
||||
0, 0, 0, 32, 0, 0, 0, 0, // time tag
|
||||
0, 0, 0, 52, // content size
|
||||
35, 98, 117, 110, 100, 108, 101, 0, // #bundle
|
||||
0, 0, 0, 64, 0, 0, 0, 0, // time tag
|
||||
0, 0, 0, 32, // content size
|
||||
47, 111, 115, 99, 105, 108, 108, 97, 116, 111, 114, 47, 52,
|
||||
47, 102, 114, 101, 113, 117, 101, 110, 99, 121, 0,
|
||||
44, 102, 0, 0, 67, 220, 0, 0},
|
||||
}
|
||||
|
||||
for _, seed := range seedBytes {
|
||||
f.Add(seed)
|
||||
}
|
||||
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
_, _, _ = BundleFromBytes(data)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user