Add a fuzz target for instantiating wasm-smith modules

This commit is contained in:
Nick Fitzgerald
2020-08-25 09:02:08 -07:00
parent 7c85654285
commit d688458619
3 changed files with 35 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ target-lexicon = "0.10"
peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing", optional = true }
wasmtime = { path = "../crates/wasmtime" }
wasmtime-fuzzing = { path = "../crates/fuzzing" }
wasm-smith = "0.1.1"
[[bin]]
name = "compile"
@@ -100,3 +101,9 @@ required-features = ["peepmatic-fuzzing"]
[features]
binaryen = ["wasmtime-fuzzing/binaryen"]
[[bin]]
name = "instantiate-wasm-smith"
path = "fuzz_targets/instantiate-wasm-smith.rs"
test = false
doc = false

View File

@@ -0,0 +1,13 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use wasm_smith::Module;
use wasmtime::Strategy;
use wasmtime_fuzzing::oracles;
fuzz_target!(|module: Module| {
let mut module = module;
module.ensure_termination(1000);
let wasm_bytes = module.to_bytes();
oracles::instantiate(&wasm_bytes, Strategy::Auto);
});