File: fuzz.go

package info (click to toggle)
golang-github-mdlayher-ndp 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 244 kB
  • sloc: makefile: 3
file content (25 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package ndp

import (
	"fmt"
)

// fuzz is a shared function for go-fuzz and tests that verify go-fuzz bugs
// are fixed.
func fuzz(data []byte) int {
	m, err := ParseMessage(data)
	if err != nil {
		return 0
	}

	b2, err := MarshalMessage(m)
	if err != nil {
		panic(fmt.Sprintf("failed to marshal: %v", err))
	}

	if _, err := ParseMessage(b2); err != nil {
		panic(fmt.Sprintf("failed to parse: %v", err))
	}

	return 1
}