Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzz all the backends. #938

Merged
merged 1 commit into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ cargo-fuzz = true
wasmer-runtime = { path = "../lib/runtime" }
wasmer-runtime-core = { path = "../lib/runtime-core" }
wasmer = { path = "../" }
wasmer-llvm-backend = { path = "../lib/llvm-backend" }
wasmer-singlepass-backend = { path = "../lib/singlepass-backend" }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }

# Prevent this from interfering with workspaces
Expand Down
17 changes: 16 additions & 1 deletion fuzz/fuzz_targets/compile_wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@
#[macro_use]
extern crate libfuzzer_sys;
extern crate wasmer_runtime;
extern crate wasmer_runtime_core;
extern crate wasmer_llvm_backend;
extern crate wasmer_singlepass_backend;

use wasmer_runtime::compile;
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()
}

fuzz_target!(|data: &[u8]| {
let _ = compile_with(data, &get_llvm_compiler());
let _ = compile(data);
let _ = compile_with(data, &get_singlepass_compiler());
});