wasmer/fuzz/fuzz_targets/compile_wasm.rs

26 lines
702 B
Rust
Raw Normal View History

2019-09-09 09:45:24 +00:00
#![no_main]
#[macro_use]
extern crate libfuzzer_sys;
extern crate wasmer_runtime;
2019-11-08 19:10:44 +00:00
extern crate wasmer_runtime_core;
extern crate wasmer_llvm_backend;
extern crate wasmer_singlepass_backend;
2019-09-09 09:45:24 +00:00
2019-11-08 19:10:44 +00:00
use wasmer_runtime::{compile, compile_with};
use wasmer_runtime_core::backend::Compiler;
fn get_llvm_compiler() -> impl Compiler {
use wasmer_llvm_backend::LLVMCompiler;
LLVMCompiler::new()
}
fn get_singlepass_compiler() -> impl Compiler {
use wasmer_singlepass_backend::SinglePassCompiler;
SinglePassCompiler::new()
}
2019-09-09 09:45:24 +00:00
fuzz_target!(|data: &[u8]| {
2019-11-08 19:10:44 +00:00
let _ = compile_with(data, &get_llvm_compiler());
2019-09-09 09:45:24 +00:00
let _ = compile(data);
2019-11-08 19:10:44 +00:00
let _ = compile_with(data, &get_singlepass_compiler());
2019-09-09 09:45:24 +00:00
});