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