mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-31 07:12:10 +00:00
Merge #768
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:
@@ -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 `compile_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);
|
||||
});
|
Reference in New Issue
Block a user