add afl fuzz target

This commit is contained in:
Noah Hellman 2023-02-01 17:44:42 +01:00
parent 78987f7ba3
commit 28c2bfbe8c
6 changed files with 367 additions and 0 deletions

12
tests/afl/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "jotdown-afl"
version = "0.1.0"
edition = "2021"
[dependencies]
afl = "0.11"
jotdown = { path = "../../" }
[[bin]]
name = "gen"
path = "src/gen.rs"

35
tests/afl/in/all.dj Normal file
View file

@ -0,0 +1,35 @@
{.class}
{#id}
{attr=value}
# heading
## sub heading
para
::: div-class
- list item
- indented list item
```lang
code block
```
:::
> blockquote
> > inner
> > inner
> outer
[tag]: url
[^footnote]: description
inline `verbatim` _emphasis_, *strong*, ^sup^, ~sub~, {-del-}, {+ins+} \
[link][], [text][tag], [text](url), ![alt text](src), <https://example.com>,
<mail@example.com>, {=mark=}, 'single', "double", $`inline`, $$`display`
{%comment%}, [span of text]{with=some .attributes}, $`<em>raw html</em>`{=html}
- * - * - * -

11
tests/afl/src/gen.rs Normal file
View file

@ -0,0 +1,11 @@
use afl::fuzz;
fn main() {
fuzz!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
let p = jotdown::Parser::new(s);
let mut output = String::new();
jotdown::html::push(p, &mut output);
}
});
}