mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-05 02:20:19 +00:00
add new fuzzer for compile method
This commit is contained in:
parent
30d80c3956
commit
599ecb7ae6
@ -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"
|
@ -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:
|
||||
|
||||
|
10
fuzz/fuzz_targets/compile_wasm.rs
Normal file
10
fuzz/fuzz_targets/compile_wasm.rs
Normal 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);
|
||||
});
|
Loading…
Reference in New Issue
Block a user