Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,27 @@ fn fuzz() -> Result<(), String> {
"yy: link and title with newline (GH-79)"
);

// Additional shape variants of the same `subtokenize.rs:149` panic
// ("expected link"), found via fuzzing. All three reach the same
// chain-walker that calls `enter.link.as_ref().expect("expected link")`
// on an event whose `link` field is `None` (added by `attention.rs`
// without a `Link` payload).

assert!(
matches!(
to_html_with_options("[x](/x \"> \n\")", &Options::default()),
Ok(_)
),
"yy: link with quoted title containing `> ` and newline (GH-79 variant)"
);

assert!(
matches!(
to_html_with_options("[][a \n]\n\n[a ]:\0", &Options::default()),
Ok(_)
),
"yy: collapsed-reference link with space-newline label and NUL url (GH-79 variant)"
);

Ok(())
}
Loading