Skip to content

Commit

Permalink
fuzzing optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
pventuzelo committed Jul 16, 2020
1 parent 8b83c9d commit 7b47782
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 137 deletions.
10 changes: 6 additions & 4 deletions warf/targets/src/binaryen_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ BINARYEN (Rust binding using FFI)
/// TODO: Verify that binary contains coverage for C++ code of binaryen.
pub fn fuzz_binaryen_ffi(data: &[u8]) -> bool {
use binaryen::Module;

Module::read(&data).is_ok()
}

pub fn fuzz_binaryen_optimize_ffi(data: &[u8]) -> bool {
use binaryen::{CodegenConfig, Module};

let mut module = match Module::read(&data) {
Ok(o) => o,
Err(_) => return false,
};
let config = CodegenConfig {
optimization_level: 4,
shrink_level: 0,
debug_info: true,
};
let mut module = match Module::read(&data) {
Ok(o) => o,
Err(_) => return false,
};
module.optimize(&config);
true
}
Loading

0 comments on commit 7b47782

Please sign in to comment.