github.com/MontFerret/ferret@v0.18.0/pkg/compiler/fuzz/fuzz.go (about)

     1  package compiler_test
     2  
     3  import (
     4  	"github.com/MontFerret/ferret/pkg/compiler"
     5  )
     6  
     7  // Fuzz is our fuzzer.
     8  // The fuzzer is run on oss-fuzz.
     9  // Link to the project on oss-fuzz
    10  // will be added once the project is up.
    11  func Fuzz(data []byte) int {
    12  	c := compiler.New()
    13  	p, err := c.Compile(string(data))
    14  	if err != nil || p == nil {
    15  		return 0
    16  	}
    17  	return 1
    18  }