diff options
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/Cargo.toml | 25 | ||||
-rw-r--r-- | fuzz/fuzz_targets/micromark.rs | 16 |
2 files changed, 41 insertions, 0 deletions
diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000..3c19003 --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "micromark-fuzz" +version = "0.0.0" +authors = ["Automatically generated"] +publish = false +edition = "2018" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" + +[dependencies.micromark] +path = ".." + +# Prevent this from interfering with workspaces +[workspace] +members = ["."] + +[[bin]] +name = "micromark" +path = "fuzz_targets/micromark.rs" +test = false +doc = false diff --git a/fuzz/fuzz_targets/micromark.rs b/fuzz/fuzz_targets/micromark.rs new file mode 100644 index 0000000..f4d2927 --- /dev/null +++ b/fuzz/fuzz_targets/micromark.rs @@ -0,0 +1,16 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +extern crate micromark; + +fuzz_target!(|data: &[u8]| { + if let Ok(s) = std::str::from_utf8(data) { + let _ = micromark::micromark(s); + let _ = micromark::micromark_with_options( + s, + µmark::Options { + constructs: micromark::Constructs::gfm(), + ..micromark::Options::default() + }, + ); + } +}); |