github.com/benhoyt/goawk@v1.8.1/fuzz/interp/interp.go (about)

     1  // +build gofuzz
     2  
     3  package fuzz
     4  
     5  import (
     6  	"bytes"
     7  	"github.com/benhoyt/goawk/interp"
     8  )
     9  
    10  func Fuzz(data []byte) int {
    11  	input := bytes.NewReader([]byte("foo bar\nbaz buz\n"))
    12  	err := interp.Exec(string(data), " ", input, &bytes.Buffer{})
    13  	if err != nil {
    14  		return 0
    15  	}
    16  	return 1
    17  }