Merge pull request #15 from pepyakin/fuzz-load
Fuzz loading/validation against wabt.
This commit is contained in:
commit
aa42ac9e70
|
@ -0,0 +1,4 @@
|
|||
|
||||
target
|
||||
corpus
|
||||
artifacts
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
[package]
|
||||
name = "wasmi-fuzz"
|
||||
version = "0.0.1"
|
||||
authors = ["Automatically generated"]
|
||||
publish = false
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
wasmi = { path = ".." }
|
||||
wabt = "0.1.6"
|
||||
|
||||
[dependencies.libfuzzer-sys]
|
||||
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
members = ["."]
|
||||
|
||||
[[bin]]
|
||||
name = "load"
|
||||
path = "fuzz_targets/load.rs"
|
|
@ -0,0 +1,13 @@
|
|||
#![no_main]
|
||||
#[macro_use] extern crate libfuzzer_sys;
|
||||
extern crate wasmi;
|
||||
extern crate wabt;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let wasmi_result = wasmi::load_from_buffer(data);
|
||||
|
||||
// TODO: Do validation only! https://github.com/pepyakin/wasmi/issues/16
|
||||
let wabt_result = wabt::wasm2wat(data);
|
||||
|
||||
assert_eq!(wasmi_result.is_ok(), wabt_result.is_ok());
|
||||
});
|
Loading…
Reference in New Issue