Skip to content

Commit 237a3ac

Browse files
authored
Merge pull request #2162 from fitzgen/wasm-smith-fuzzing
Add a fuzz target for instantiating `wasm-smith` modules
2 parents 7c85654 + d688458 commit 237a3ac

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

Cargo.lock

Lines changed: 15 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzz/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ target-lexicon = "0.10"
1717
peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing", optional = true }
1818
wasmtime = { path = "../crates/wasmtime" }
1919
wasmtime-fuzzing = { path = "../crates/fuzzing" }
20+
wasm-smith = "0.1.1"
2021

2122
[[bin]]
2223
name = "compile"
@@ -100,3 +101,9 @@ required-features = ["peepmatic-fuzzing"]
100101

101102
[features]
102103
binaryen = ["wasmtime-fuzzing/binaryen"]
104+
105+
[[bin]]
106+
name = "instantiate-wasm-smith"
107+
path = "fuzz_targets/instantiate-wasm-smith.rs"
108+
test = false
109+
doc = false
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![no_main]
2+
3+
use libfuzzer_sys::fuzz_target;
4+
use wasm_smith::Module;
5+
use wasmtime::Strategy;
6+
use wasmtime_fuzzing::oracles;
7+
8+
fuzz_target!(|module: Module| {
9+
let mut module = module;
10+
module.ensure_termination(1000);
11+
let wasm_bytes = module.to_bytes();
12+
oracles::instantiate(&wasm_bytes, Strategy::Auto);
13+
});

0 commit comments

Comments
 (0)