Skip to content

Commit

Permalink
Initial commit of a fuzzer. Run with "cargo fuzz run simple_instantia…
Browse files Browse the repository at this point in the history
…te".

Used to discover issue wasmerio#558.

We'll probably want to reconsider the default .gitignore of the artifacts and corpus directories. The fuzzer wastes a lot of time not having even a single exampel of a valid .wasm file to start with.
  • Loading branch information
nlewycky committed Jul 14, 2019
1 parent 13abdfe commit 5c0ede0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target
corpus
artifacts
21 changes: 21 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

[package]
name = "wasmer-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false

[package.metadata]
cargo-fuzz = true

[dependencies]
wasmer-runtime = { path = "../lib/runtime" }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }

# Prevent this from interfering with workspaces
[workspace]
members = ["."]

[[bin]]
name = "simple_instantiate"
path = "fuzz_targets/simple_instantiate.rs"
13 changes: 13 additions & 0 deletions fuzz/fuzz_targets/simple_instantiate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate wasmer_runtime;

use wasmer_runtime::{
instantiate,
imports,
};

fuzz_target!(|data: &[u8]| {
let import_object = imports! {};
instantiate(data, &import_object);
});

0 comments on commit 5c0ede0

Please sign in to comment.