2017-09-06 17:33:12 -07:00
|
|
|
#![no_main]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate libfuzzer_sys;
|
|
|
|
extern crate parity_wasm;
|
2018-01-20 01:47:56 +03:00
|
|
|
extern crate binaryen;
|
2017-09-06 17:33:12 -07:00
|
|
|
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
2018-01-23 22:47:20 +03:00
|
|
|
let binaryen_module = binaryen::tools::translate_to_fuzz(data);
|
2017-09-06 17:33:12 -07:00
|
|
|
|
2018-01-23 22:47:20 +03:00
|
|
|
// enable binaryen's validation if in doubt.
|
|
|
|
// assert!(binaryen_module.is_valid());
|
2017-09-06 17:33:12 -07:00
|
|
|
|
2018-01-23 22:47:20 +03:00
|
|
|
let wasm = binaryen_module.write();
|
2017-09-06 17:33:12 -07:00
|
|
|
|
2018-01-23 22:47:20 +03:00
|
|
|
let _module: parity_wasm::elements::Module = parity_wasm::deserialize_buffer(&wasm)
|
|
|
|
.expect(
|
|
|
|
"deserialize output of wasm-opt, indicating possible bug in deserializer",
|
|
|
|
);
|
2017-09-06 17:33:12 -07:00
|
|
|
});
|