summaryrefslogtreecommitdiff
path: root/vendor/github.com/cilium/ebpf/elf_reader_fuzz.go
blob: d46d135f2fcd15f87b1faab8c4fdcd9d9df61fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build gofuzz

// Use with https://github.com/dvyukov/go-fuzz

package ebpf

import "bytes"

func FuzzLoadCollectionSpec(data []byte) int {
	spec, err := LoadCollectionSpecFromReader(bytes.NewReader(data))
	if err != nil {
		if spec != nil {
			panic("spec is not nil")
		}
		return 0
	}
	if spec == nil {
		panic("spec is nil")
	}
	return 1
}