forked from cerc-io/plugeth
core/vm, crypto: support for go-fuzz (#3672)
This commit is contained in:
parent
94334c233e
commit
4ac481b45f
20
core/vm/runtime/fuzz.go
Normal file
20
core/vm/runtime/fuzz.go
Normal file
@ -0,0 +1,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
|
||||
}
|
Loading…
Reference in New Issue
Block a user