768: [new fuzzer] wasmer compile method r=syrusakbary a=pventuzelo

Useful to fuzz wasmer compile method and cranelift library

Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
This commit is contained in:
bors[bot]
2019-09-09 22:28:12 +00:00
committed by GitHub
3 changed files with 19 additions and 1 deletions

View File

@@ -25,3 +25,7 @@ path = "fuzz_targets/simple_instantiate.rs"
[[bin]]
name = "validate_wasm"
path = "fuzz_targets/validate_wasm.rs"
[[bin]]
name = "compile_wasm"
path = "fuzz_targets/compile_wasm.rs"

View File

@@ -10,7 +10,7 @@ $ cargo install cargo-fuzz
`cargo-fuzz` is documented in the [Rust Fuzz Book](https://rust-fuzz.github.io/book/cargo-fuzz.html).
## Running a fuzzer (simple_instantiate, validate_wasm)
## Running a fuzzer (simple_instantiate, validate_wasm, compile_wasm)
Once `cargo-fuzz` is installed, you can run the `simple_instantiate` fuzzer with
```sh
@@ -20,6 +20,10 @@ or the `validate_wasm` fuzzer
```sh
cargo fuzz run validate_wasm
```
or the `compile_wasm` fuzzer
```sh
cargo fuzz run compile_wasm
```
You should see output that looks something like this:

View File

@@ -0,0 +1,10 @@
#![no_main]
#[macro_use]
extern crate libfuzzer_sys;
extern crate wasmer_runtime;
use wasmer_runtime::compile;
fuzz_target!(|data: &[u8]| {
let _ = compile(data);
});