github.com/devfans/go-ethereum@v1.5.10-0.20170326212234-7419d0c38291/core/vm/runtime/fuzz.go (about)

     1  // +build gofuzz
     2  
     3  package runtime
     4  
     5  // Fuzz is the basic entry point for the go-fuzz tool
     6  //
     7  // This returns 1 for valid parsable/runable code, 0
     8  // for invalid opcode.
     9  func Fuzz(input []byte) int {
    10  	_, _, err := Execute(input, input, &Config{
    11  		GasLimit: 3000000,
    12  	})
    13  
    14  	// invalid opcode
    15  	if err != nil && len(err.Error()) > 6 && string(err.Error()[:7]) == "invalid" {
    16  		return 0
    17  	}
    18  
    19  	return 1
    20  }