Skip to content

Fix panic on definition-list offsets inside a combining character - #1143

Merged
notriddle merged 1 commit into
pulldown-cmark:mainfrom
teddytennant:fix/deflist-tab-char-boundary
Sep 10, 2026
Merged

notriddle merged 1 commit into
pulldown-cmark:mainfrom
teddytennant:fix/deflist-tab-char-boundary

Conversation

@teddytennant

Copy link
Copy Markdown
Contributor

into_offset_iter panicked on this definition list, found by a fuzzer:

%\n:\u{301}\n\t:

The second definition's start was container_start - outer_indent. outer_indent is columns, not bytes, so with a leftover tab width the start landed inside U+0301 (bytes 3..5) at index 4.

Use start_ix + save.bytes_scanned() for that start instead, same as the indent that was actually consumed. issue_1142_deflist_offset_is_char_boundary slices every offset range of that input.

cargo test -p pulldown-cmark 1248 tests + 6 doctests passed.

Closes #1142.

A TAB-indented second definition computed its start as
container_start - outer_indent. outer_indent is columns, so that
subtraction could land inside a preceding multibyte character
(U+0301 in issue 1142) and into_offset_iter ranges were not valid
&str slices.
@Martin1887

Copy link
Copy Markdown
Collaborator

Thanks, but please put the test in specs/regressions.txt like other similar issues.

@teddytennant

Copy link
Copy Markdown
Contributor Author

specs only compare HTML output, and this input renders the same with and without the fix, so a case there passes either way. The panic is in into_offset_iter, so I put the test next to offset_iter_issue_378/_404 in parse.rs.

@Martin1887

Copy link
Copy Markdown
Collaborator

Good point, thanks.

@notriddle
notriddle merged commit 6b9b7da into pulldown-cmark:main Sep 10, 2026
6 checks passed
@notriddle notriddle mentioned this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic with ENABLE_DEFINITION_LIST

3 participants