fuzz: add differential_spec fuzzing target

This new target compares the outputs of executing the first exported
function of a Wasm module in Wasmtime and in the official Wasm spec
interpreter (using the `wasm-spec-interpreter` crate). This is an
initial step towards more fully-featured fuzzing (e.g. compare memories,
add `v128`, add references, add other proposals, etc.)
This commit is contained in:
Andrew Brown
2021-07-28 13:21:42 -07:00
parent f3955fa62a
commit 651a321f1a
3 changed files with 161 additions and 10 deletions

View File

@@ -0,0 +1,13 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use wasmtime_fuzzing::{generators, oracles};
fuzz_target!(|data: (
generators::Config,
wasm_smith::ConfiguredModule<oracles::SingleFunctionModuleConfig>
)| {
let (config, mut wasm) = data;
wasm.ensure_termination(1000);
oracles::differential_spec_execution(&wasm.to_bytes(), &config);
});