diff options
author | Pascal Hertleif <killercup@gmail.com> | 2017-11-19 20:03:16 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-11-24 15:29:38 +0100 |
commit | e8afcf56c124b228e4328760af6a7741b1bdd658 (patch) | |
tree | 3acc385473b2f1362743089ce502f16371ff18b9 | |
parent | 9b990ff630864c5245328c015cab94af98ae3f0a (diff) |
Add simple fuzzer for parser
-rw-r--r-- | fuzz/.gitignore | 4 | ||||
-rw-r--r-- | fuzz/Cargo.toml | 22 | ||||
-rw-r--r-- | fuzz/fuzz_targets/parse.rs | 9 |
3 files changed, 35 insertions, 0 deletions
diff --git a/fuzz/.gitignore b/fuzz/.gitignore new file mode 100644 index 0000000..572e03b --- /dev/null +++ b/fuzz/.gitignore @@ -0,0 +1,4 @@ + +target +corpus +artifacts diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000..8aa3986 --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,22 @@ + +[package] +name = "kairos-fuzz" +version = "0.0.1" +authors = ["Automatically generated"] +publish = false + +[package.metadata] +cargo-fuzz = true + +[dependencies.kairos] +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" diff --git a/fuzz/fuzz_targets/parse.rs b/fuzz/fuzz_targets/parse.rs new file mode 100644 index 0000000..5d6aa8b --- /dev/null +++ b/fuzz/fuzz_targets/parse.rs @@ -0,0 +1,9 @@ +#![no_main] +#[macro_use] extern crate libfuzzer_sys; +extern crate kairos; + +fuzz_target!(|data: &[u8]| { + if let Ok(data) = std::str::from_utf8(data) { + let _ = kairos::parser::parse(data); + } +}); |