diff options
Diffstat (limited to '')
-rw-r--r-- | fuzz/Cargo.toml | 11 | ||||
-rw-r--r-- | fuzz/fuzz_targets/markdown_honggfuzz.rs | 15 | ||||
-rw-r--r-- | fuzz/fuzz_targets/markdown_libfuzz.rs (renamed from fuzz/fuzz_targets/markdown.rs) | 0 |
3 files changed, 24 insertions, 2 deletions
diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index c8f9850..6a50fd2 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,6 +10,7 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" +honggfuzz = "0.5" [dependencies.markdown] path = ".." @@ -19,7 +20,13 @@ path = ".." members = ["."] [[bin]] -name = "markdown" -path = "fuzz_targets/markdown.rs" +name = "markdown_libfuzz" +path = "fuzz_targets/markdown_libfuzz.rs" test = false doc = false + +[[bin]] +name = "markdown_honggfuzz" +path = "fuzz_targets/markdown_honggfuzz.rs" +test = false +doc = false
\ No newline at end of file diff --git a/fuzz/fuzz_targets/markdown_honggfuzz.rs b/fuzz/fuzz_targets/markdown_honggfuzz.rs new file mode 100644 index 0000000..6aa3c79 --- /dev/null +++ b/fuzz/fuzz_targets/markdown_honggfuzz.rs @@ -0,0 +1,15 @@ +use honggfuzz::fuzz; + +fn main() { + loop { + fuzz!(|data: &[u8]| { + if let Ok(s) = std::str::from_utf8(data) { + let _ = markdown::to_html(s); + let _ = markdown::to_html_with_options(s, &markdown::Options::gfm()); + let _ = markdown::to_mdast(s, &markdown::ParseOptions::default()); + let _ = markdown::to_mdast(s, &markdown::ParseOptions::gfm()); + let _ = markdown::to_mdast(s, &markdown::ParseOptions::mdx()); + } + }); + } +} diff --git a/fuzz/fuzz_targets/markdown.rs b/fuzz/fuzz_targets/markdown_libfuzz.rs index ca6d86b..ca6d86b 100644 --- a/fuzz/fuzz_targets/markdown.rs +++ b/fuzz/fuzz_targets/markdown_libfuzz.rs |