From 4b16a4ad85588124022dcaa11a93be93e6edf17b Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 1 May 2020 16:17:43 -0700 Subject: [PATCH] peepmatic: Define fuzz targets for various parts of `peepmatic` --- fuzz/Cargo.toml | 31 +++++++++++++++++++ fuzz/fuzz_targets/peepmatic_compile.rs | 8 +++++ .../peepmatic_fst_differential.rs | 8 +++++ fuzz/fuzz_targets/peepmatic_interp.rs | 8 +++++ fuzz/fuzz_targets/peepmatic_parser.rs | 8 +++++ .../fuzz_targets/peepmatic_simple_automata.rs | 7 +++++ 6 files changed, 70 insertions(+) create mode 100644 fuzz/fuzz_targets/peepmatic_compile.rs create mode 100644 fuzz/fuzz_targets/peepmatic_fst_differential.rs create mode 100644 fuzz/fuzz_targets/peepmatic_interp.rs create mode 100644 fuzz/fuzz_targets/peepmatic_parser.rs create mode 100644 fuzz/fuzz_targets/peepmatic_simple_automata.rs diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 38fa092d58..f6ed67ac8e 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -14,6 +14,7 @@ cranelift-reader = { path = "../cranelift/reader" } cranelift-wasm = { path = "../cranelift/wasm" } libfuzzer-sys = "0.3.2" target-lexicon = "0.10" +peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing" } wasmtime = { path = "../crates/wasmtime" } wasmtime-fuzzing = { path = "../crates/fuzzing" } @@ -56,5 +57,35 @@ path = "fuzz_targets/spectests.rs" test = false doc = false +[[bin]] +name = "peepmatic_simple_automata" +path = "fuzz_targets/peepmatic_simple_automata.rs" +test = false +doc = false + +[[bin]] +name = "peepmatic_fst_differential" +path = "fuzz_targets/peepmatic_fst_differential.rs" +test = false +doc = false + +[[bin]] +name = "peepmatic_parser" +path = "fuzz_targets/peepmatic_parser.rs" +test = false +doc = false + +[[bin]] +name = "peepmatic_compile" +path = "fuzz_targets/peepmatic_compile.rs" +test = false +doc = false + +[[bin]] +name = "peepmatic_interp" +path = "fuzz_targets/peepmatic_interp.rs" +test = false +doc = false + [features] binaryen = ['wasmtime-fuzzing/binaryen'] diff --git a/fuzz/fuzz_targets/peepmatic_compile.rs b/fuzz/fuzz_targets/peepmatic_compile.rs new file mode 100644 index 0000000000..623d747280 --- /dev/null +++ b/fuzz/fuzz_targets/peepmatic_compile.rs @@ -0,0 +1,8 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; +use peepmatic_fuzzing::compile::compile; + +fuzz_target!(|data: &[u8]| { + compile(data); +}); diff --git a/fuzz/fuzz_targets/peepmatic_fst_differential.rs b/fuzz/fuzz_targets/peepmatic_fst_differential.rs new file mode 100644 index 0000000000..00549112db --- /dev/null +++ b/fuzz/fuzz_targets/peepmatic_fst_differential.rs @@ -0,0 +1,8 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +use peepmatic_fuzzing::automata::fst_differential; +use std::collections::HashMap; + +fuzz_target!(|map: HashMap, u64>| { + fst_differential(map); +}); diff --git a/fuzz/fuzz_targets/peepmatic_interp.rs b/fuzz/fuzz_targets/peepmatic_interp.rs new file mode 100644 index 0000000000..dd3c1732ab --- /dev/null +++ b/fuzz/fuzz_targets/peepmatic_interp.rs @@ -0,0 +1,8 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; +use peepmatic_fuzzing::interp::interp; + +fuzz_target!(|data: &[u8]| { + interp(data); +}); diff --git a/fuzz/fuzz_targets/peepmatic_parser.rs b/fuzz/fuzz_targets/peepmatic_parser.rs new file mode 100644 index 0000000000..5664dad41b --- /dev/null +++ b/fuzz/fuzz_targets/peepmatic_parser.rs @@ -0,0 +1,8 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; +use peepmatic_fuzzing::parser::parse; + +fuzz_target!(|data: &[u8]| { + parse(data); +}); diff --git a/fuzz/fuzz_targets/peepmatic_simple_automata.rs b/fuzz/fuzz_targets/peepmatic_simple_automata.rs new file mode 100644 index 0000000000..ecf2fd7850 --- /dev/null +++ b/fuzz/fuzz_targets/peepmatic_simple_automata.rs @@ -0,0 +1,7 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +use peepmatic_fuzzing::automata::simple_automata; + +fuzz_target!(|input_output_pairs: Vec)>>| { + simple_automata(input_output_pairs); +});