Skip to content

Commit

Permalink
Add simple parser fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
killercup committed Nov 27, 2017
1 parent fe00abf commit aafaebf
Show file tree
Hide file tree
Showing 3 changed files with 35 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
22 changes: 22 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

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

[package.metadata]
cargo-fuzz = true

[dependencies.Molten]
path = ".."
[dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"

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

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

fuzz_target!(|data: &[u8]| {
if let Ok(text) = ::std::str::from_utf8(data) {
let _ = Molten::parser::Parser::new(text).parse();
}
});

0 comments on commit aafaebf

Please sign in to comment.