Add a fuzz target for instantiating wasm-smith modules
This commit is contained in:
19
Cargo.lock
generated
19
Cargo.lock
generated
@@ -56,9 +56,9 @@ checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arbitrary"
|
name = "arbitrary"
|
||||||
version = "0.4.5"
|
version = "0.4.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7cb544f1057eaaff4b34f8c4dcf56fc3cd04debd291998405d135017a7c3c0f4"
|
checksum = "0922a3e746b5a44e111e5603feb6704e5cc959116f66737f50bb5cbd264e9d87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_arbitrary",
|
"derive_arbitrary",
|
||||||
]
|
]
|
||||||
@@ -656,9 +656,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_arbitrary"
|
name = "derive_arbitrary"
|
||||||
version = "0.4.5"
|
version = "0.4.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02b43185d3e7ce7dcd44a23ca761ec026359753ebf480283a571e6463853d2ef"
|
checksum = "d0f7c6c81276b6b8702074defbdb1938933ddf98c7f7e0dca8d9e9214dd6c730"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2285,6 +2285,16 @@ dependencies = [
|
|||||||
"yanix",
|
"yanix",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-smith"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ec52a2524c15abcc827e59c1eef9cdb742b4ba57a6db6a1ccd914e357326edd"
|
||||||
|
dependencies = [
|
||||||
|
"arbitrary",
|
||||||
|
"leb128",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmparser"
|
name = "wasmparser"
|
||||||
version = "0.57.0"
|
version = "0.57.0"
|
||||||
@@ -2467,6 +2477,7 @@ dependencies = [
|
|||||||
"libfuzzer-sys",
|
"libfuzzer-sys",
|
||||||
"peepmatic-fuzzing",
|
"peepmatic-fuzzing",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
|
"wasm-smith",
|
||||||
"wasmtime",
|
"wasmtime",
|
||||||
"wasmtime-fuzzing",
|
"wasmtime-fuzzing",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ target-lexicon = "0.10"
|
|||||||
peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing", optional = true }
|
peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing", optional = true }
|
||||||
wasmtime = { path = "../crates/wasmtime" }
|
wasmtime = { path = "../crates/wasmtime" }
|
||||||
wasmtime-fuzzing = { path = "../crates/fuzzing" }
|
wasmtime-fuzzing = { path = "../crates/fuzzing" }
|
||||||
|
wasm-smith = "0.1.1"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "compile"
|
name = "compile"
|
||||||
@@ -100,3 +101,9 @@ required-features = ["peepmatic-fuzzing"]
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
binaryen = ["wasmtime-fuzzing/binaryen"]
|
binaryen = ["wasmtime-fuzzing/binaryen"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "instantiate-wasm-smith"
|
||||||
|
path = "fuzz_targets/instantiate-wasm-smith.rs"
|
||||||
|
test = false
|
||||||
|
doc = false
|
||||||
|
|||||||
13
fuzz/fuzz_targets/instantiate-wasm-smith.rs
Executable file
13
fuzz/fuzz_targets/instantiate-wasm-smith.rs
Executable 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);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user