add new fuzzer for compile method

This commit is contained in:
Patrick Ventuzelo 2019-09-09 11:45:24 +02:00
parent 30d80c3956
commit 599ecb7ae6
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 `validate_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);
});