Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/operators/matchers/fuzz.go
4538 views
1
//go:build gofuzz
2
// +build gofuzz
3
4
package matchers
5
6
import "github.com/projectdiscovery/nuclei/v3/pkg/operators/cache"
7
8
func init() {
9
cache.SetCapacities(128, 128)
10
}
11
12
// Fuzz exercises matcher compilation with a compact line-based grammar.
13
func Fuzz(data []byte) int {
14
if len(data) == 0 {
15
return 0
16
}
17
if len(data) > fuzzMaxInputSize {
18
return -1
19
}
20
21
matcher, ok := matcherFromFuzzData(data)
22
if !ok {
23
return 0
24
}
25
if err := matcher.CompileMatchers(); err != nil {
26
return 0
27
}
28
return 1
29
}
30
31