pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/knf/fuzz.go (about)

     1  //go:build gofuzz
     2  // +build gofuzz
     3  
     4  package knf
     5  
     6  // ////////////////////////////////////////////////////////////////////////////////// //
     7  //                                                                                    //
     8  //                         Copyright (c) 2022 ESSENTIAL KAOS                          //
     9  //      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
    10  //                                                                                    //
    11  // ////////////////////////////////////////////////////////////////////////////////// //
    12  
    13  import (
    14  	"bytes"
    15  )
    16  
    17  // ////////////////////////////////////////////////////////////////////////////////// //
    18  
    19  func Fuzz(data []byte) int {
    20  	_, err := readKNFData(bytes.NewReader(data))
    21  
    22  	if err != nil {
    23  		return 0
    24  	}
    25  
    26  	return 1
    27  }