diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-02-21 17:24:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 17:24:07 +0800 |
commit | 4ac481b45ff674c397233a580a6b6ed6fd486ac2 (patch) | |
tree | 0a8228fc3d856af08160f62b2dbb5b0c99f6e889 /core | |
parent | 94334c233e5f02324d4427ffe6ffc14d41576e36 (diff) | |
download | dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.tar dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.tar.gz dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.tar.bz2 dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.tar.lz dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.tar.xz dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.tar.zst dexon-4ac481b45ff674c397233a580a6b6ed6fd486ac2.zip |
core/vm, crypto: support for go-fuzz (#3672)
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/runtime/fuzz.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/vm/runtime/fuzz.go b/core/vm/runtime/fuzz.go new file mode 100644 index 000000000..de5b0f45d --- /dev/null +++ b/core/vm/runtime/fuzz.go @@ -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 +} |