From 4ac481b45ff674c397233a580a6b6ed6fd486ac2 Mon Sep 17 00:00:00 2001
From: Jeffrey Wilcke <jeffrey@ethereum.org>
Date: Tue, 21 Feb 2017 10:24:07 +0100
Subject: core/vm, crypto: support for go-fuzz (#3672)

---
 core/vm/runtime/fuzz.go | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 core/vm/runtime/fuzz.go

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
+}
-- 
cgit v1.2.3