Add plain load to fuzzer (#58)

This commit is contained in:
Sergey Pepyakin 2018-02-15 20:34:56 +03:00 committed by GitHub
parent d11dffcf51
commit d02b0f8527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 6 deletions

View File

@ -24,6 +24,10 @@ members = ["."]
name = "load"
path = "fuzz_targets/load.rs"
[[bin]]
name = "load_wabt"
path = "fuzz_targets/load_wabt.rs"
[[bin]]
name = "load_wasmparser"
path = "fuzz_targets/load_wasmparser.rs"

View File

@ -1,13 +1,9 @@
#![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());
// Just check if loading some arbitrary buffer doesn't panic.
let _ = wasmi::Module::from_buffer(data);
});

View File

@ -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());
});