...
1
2
3
4 package ebpf
5
6 import (
7 "bytes"
8 "debug/elf"
9 "testing"
10 )
11
12 func FuzzLoadCollectionSpec(f *testing.F) {
13 f.Add([]byte(elf.ELFMAG))
14 f.Fuzz(func(t *testing.T, data []byte) {
15 if len(data) < len(elf.ELFMAG) {
16 t.Skip("input can't be valid ELF")
17 }
18
19 spec, err := LoadCollectionSpecFromReader(bytes.NewReader(data))
20 if err != nil {
21 if spec != nil {
22 t.Fatal("spec is not nil")
23 }
24 } else if spec == nil {
25 t.Fatal("spec is nil")
26 }
27 })
28 }
29
View as plain text