Fuzz is the basic entry point for the go-fuzz tool This returns 1 for valid parsable/runable code, 0 for invalid opcode.
(input []byte)
| 23 | // This returns 1 for valid parsable/runable code, 0 |
| 24 | // for invalid opcode. |
| 25 | func Fuzz(input []byte) int { |
| 26 | _, _, err := Execute(input, input, &Config{ |
| 27 | GasLimit: 3000000, |
| 28 | }) |
| 29 | |
| 30 | // invalid opcode |
| 31 | if err != nil && len(err.Error()) > 6 && string(err.Error()[:7]) == "invalid" { |
| 32 | return 0 |
| 33 | } |
| 34 | |
| 35 | return 1 |
| 36 | } |