whatcanGOwrong

This commit is contained in:
2024-09-19 21:38:24 -04:00
commit d0ae4d841d
17908 changed files with 4096831 additions and 0 deletions
@@ -0,0 +1,25 @@
package ebpf
import (
"bytes"
"debug/elf"
"testing"
)
func FuzzLoadCollectionSpec(f *testing.F) {
f.Add([]byte(elf.ELFMAG))
f.Fuzz(func(t *testing.T, data []byte) {
if len(data) < len(elf.ELFMAG) {
t.Skip("input can't be valid ELF")
}
spec, err := LoadCollectionSpecFromReader(bytes.NewReader(data))
if err != nil {
if spec != nil {
t.Fatal("spec is not nil")
}
} else if spec == nil {
t.Fatal("spec is nil")
}
})
}