Skip to content

Instantly share code, notes, and snippets.

@fuzz-ai
Created January 8, 2019 05:32
Show Gist options
  • Select an option

  • Save fuzz-ai/3ba399fb2f6d54a740e48fc6670d6d54 to your computer and use it in GitHub Desktop.

Select an option

Save fuzz-ai/3ba399fb2f6d54a740e48fc6670d6d54 to your computer and use it in GitHub Desktop.
Ontology NeoVM fuzzing harness
// +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