aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/runtime/fuzz.go
blob: de5b0f45d946e5624a1ad7ea0941e640dac33a5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// +build gofuzz

package runtime

// Fuzz is the basic entry point for the go-fuzz tool
//
// This returns 1 for valid parsable/runable code, 0
// for invalid opcode.
func Fuzz(input []byte) int {
    _, _, err := Execute(input, input, &Config{
        GasLimit: 3000000,
    })

    // invalid opcode
    if err != nil && len(err.Error()) > 6 && string(err.Error()[:7]) == "invalid" {
        return 0
    }

    return 1
}