File: fuzz.go

package info (click to toggle)
golang-github-dlclark-regexp2 1.11.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 612 kB
  • sloc: makefile: 3
file content (20 lines) | stat: -rw-r--r-- 294 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// +build gofuzz

package syntax

// Fuzz is the input point for go-fuzz
func Fuzz(data []byte) int {
	sdata := string(data)
	tree, err := Parse(sdata, RegexOptions(0))
	if err != nil {
		return 0
	}

	// translate it to code
	_, err = Write(tree)
	if err != nil {
		panic(err)
	}

	return 1
}