Created
January 8, 2019 05:32
-
-
Save fuzz-ai/3ba399fb2f6d54a740e48fc6670d6d54 to your computer and use it in GitHub Desktop.
Ontology NeoVM fuzzing harness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // +build gofuzz | |
| package test | |
| import ( | |
| "github.com/ontio/ontology/smartcontract" | |
| "github.com/ontio/ontology/core/types" | |
| ) | |
| func Fuzz( data []byte ) int { | |
| config := &smartcontract.Config{ | |
| Time: 10, | |
| Height: 10, | |
| Tx: &types.Transaction{}, | |
| } | |
| sc := smartcontract.SmartContract{ | |
| Config: config, | |
| Gas: 100000, | |
| CacheDB: nil, | |
| } | |
| engine, err := sc.NewExecuteEngine( data ); | |
| _, err = engine.Invoke() | |
| if err != nil { | |
| return 1 | |
| } else { | |
| return 0 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment