|
|
@ -3,14 +3,12 @@ |
|
|
|
#[macro_use] |
|
|
|
extern crate libfuzzer_sys; |
|
|
|
extern crate cranelift_codegen; |
|
|
|
extern crate cranelift_wasm; |
|
|
|
extern crate cranelift_native; |
|
|
|
extern crate wasmtime_environ; |
|
|
|
extern crate wasmtime_execute; |
|
|
|
extern crate wasmparser; |
|
|
|
|
|
|
|
use cranelift_codegen::settings; |
|
|
|
use cranelift_wasm::translate_module; |
|
|
|
use wasmtime_environ::{ModuleEnvironment, Module}; |
|
|
|
use wasmparser::{validate}; |
|
|
|
|
|
|
@ -23,12 +21,12 @@ fuzz_target!(|data: &[u8]| { |
|
|
|
}); |
|
|
|
let isa = isa_builder.finish(settings::Flags::new(flag_builder)); |
|
|
|
let mut module = Module::new(); |
|
|
|
let mut environment = ModuleEnvironment::new(&*isa, &mut module); |
|
|
|
let translation = match translate_module(&data, &mut environment) { |
|
|
|
Ok(()) => (), |
|
|
|
let environment = ModuleEnvironment::new(&*isa, &mut module); |
|
|
|
let translation = match environment.translate(&data) { |
|
|
|
Ok(translation) => translation, |
|
|
|
Err(_) => return, |
|
|
|
}; |
|
|
|
let _exec = match wasmtime_execute::compile_module(&*isa, &translation) { |
|
|
|
let _exec = match wasmtime_execute::compile_and_link_module(&*isa, &translation) { |
|
|
|
Ok(x) => x, |
|
|
|
Err(_) => return, |
|
|
|
}; |
|
|
|