aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz/fuzz_targets/markdown_honggfuzz.rs
diff options
context:
space:
mode:
authorLibravatar Christian Murphy <christian.murphy.42@gmail.com>2023-04-01 03:09:26 -0700
committerLibravatar GitHub <noreply@github.com>2023-04-01 12:09:26 +0200
commitb3a921c761309ae00a51fe348d8a43adbc54b518 (patch)
tree4e3b50a46d35cd3ce768746c12088fadf36f43fc /fuzz/fuzz_targets/markdown_honggfuzz.rs
parent2498e31eecead798efc649502bbf5f86feaa94be (diff)
downloadmarkdown-rs-b3a921c761309ae00a51fe348d8a43adbc54b518.tar.gz
markdown-rs-b3a921c761309ae00a51fe348d8a43adbc54b518.tar.bz2
markdown-rs-b3a921c761309ae00a51fe348d8a43adbc54b518.zip
Add `honggfuzz` as an alternative fuzzer
Closes GH-55. Reviewed-by: Titus Wormer <tituswormer@gmail.com>
Diffstat (limited to '')
-rw-r--r--fuzz/fuzz_targets/markdown_honggfuzz.rs15
1 files changed, 15 insertions, 0 deletions
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());
+ }
+ });
+ }
+}