-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial naive fuzz testing based on wasm-smith (#405)
* remove .idea from .gitignore Developers should instead ignore .idea files locally. * initial impl for Wasm parsing, validation and translation fuzz testing This very simple implementation already found a bug in the wasmi_v1 Wasm -> wasmi bytecode translation procedure.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,7 @@ | |
**/*.rs.bk | ||
Cargo.lock | ||
spec/target | ||
.idea | ||
|
||
**/fuzz/corpus/ | ||
**/fuzz/target/ | ||
**/fuzz/artifacts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "wasmi-fuzz" | ||
version = "0.0.0" | ||
authors = ["Parity Technologies <[email protected]>", "Robin Freyler <[email protected]>"] | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
wasm-smith = "0.11" | ||
|
||
[dependencies.wasmi] | ||
path = ".." | ||
|
||
# Prevent this from interfering with workspaces | ||
[workspace] | ||
members = ["."] | ||
|
||
[[bin]] | ||
name = "translate" | ||
path = "fuzz_targets/translate.rs" | ||
test = false | ||
doc = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![no_main] | ||
use libfuzzer_sys::fuzz_target; | ||
use wasmi::{Engine, Module}; | ||
|
||
fuzz_target!(|data: wasm_smith::Module| { | ||
let wasm = data.to_bytes(); | ||
let engine = Engine::default(); | ||
Module::new(&engine, &mut &wasm[..]).unwrap(); | ||
}); |