File: fuzz.go

package info (click to toggle)
golang-github-mdlayher-ethernet 0.0~git20190606.0394541-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120 kB
  • sloc: makefile: 3
file content (24 lines) | stat: -rw-r--r-- 342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// +build gofuzz

package ethernet

func Fuzz(data []byte) int {
	f := new(Frame)
	if err := f.UnmarshalBinary(data); err != nil {
		return 0
	}

	if _, err := f.MarshalBinary(); err != nil {
		panic(err)
	}

	if err := f.UnmarshalFCS(data); err != nil {
		return 0
	}

	if _, err := f.MarshalFCS(); err != nil {
		panic(err)
	}

	return 1
}