Add plain load to fuzzer (#58)
This commit is contained in:
parent
d11dffcf51
commit
d02b0f8527
|
@ -24,6 +24,10 @@ members = ["."]
|
||||||
name = "load"
|
name = "load"
|
||||||
path = "fuzz_targets/load.rs"
|
path = "fuzz_targets/load.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "load_wabt"
|
||||||
|
path = "fuzz_targets/load_wabt.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "load_wasmparser"
|
name = "load_wasmparser"
|
||||||
path = "fuzz_targets/load_wasmparser.rs"
|
path = "fuzz_targets/load_wasmparser.rs"
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate libfuzzer_sys;
|
extern crate libfuzzer_sys;
|
||||||
extern crate wabt;
|
|
||||||
extern crate wasmi;
|
extern crate wasmi;
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
let wasmi_result = wasmi::Module::from_buffer(data);
|
// Just check if loading some arbitrary buffer doesn't panic.
|
||||||
let wabt_result =
|
let _ = wasmi::Module::from_buffer(data);
|
||||||
wabt::Module::read_binary(data, &Default::default()).and_then(|m| m.validate());
|
|
||||||
|
|
||||||
assert_eq!(wasmi_result.is_ok(), wabt_result.is_ok());
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#![no_main]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate libfuzzer_sys;
|
||||||
|
extern crate wabt;
|
||||||
|
extern crate wasmi;
|
||||||
|
|
||||||
|
fuzz_target!(|data: &[u8]| {
|
||||||
|
let wasmi_result = wasmi::Module::from_buffer(data);
|
||||||
|
let wabt_result =
|
||||||
|
wabt::Module::read_binary(data, &Default::default()).and_then(|m| m.validate());
|
||||||
|
|
||||||
|
assert_eq!(wasmi_result.is_ok(), wabt_result.is_ok());
|
||||||
|
});
|
Loading…
Reference in New Issue