Skip to content

test: GH-31 input also panics via to_html (not just to_mdast)#208

Open
ChristianMurphy wants to merge 1 commit intowooorm:test/setext-headingsfrom
ChristianMurphy:test/setext-via-to-html-pr31
Open

test: GH-31 input also panics via to_html (not just to_mdast)#208
ChristianMurphy wants to merge 1 commit intowooorm:test/setext-headingsfrom
ChristianMurphy:test/setext-via-to-html-pr31

Conversation

@ChristianMurphy
Copy link
Copy Markdown
Collaborator

This PR's existing test asserts to_mdast("=\n=\n=\na\n=", ...) returns Ok(_); in 1.0.0 release it panics at
src/to_mdast.rs:189 with "Cannot push to non-parent".

Adds a second assertion that the same input also panics through the to_html path at src/to_html.rs:197 with "at least one buffer should exist" (the same panic site reported by GH-22).

The two panic sites likely share a root cause: adjacent setext-heading underlines confuse the resolver, which produces an Exit event without a matching Enter; the to_mdast path hits the "Cannot push to non-parent" assertion in tail-stack management, and the to_html path hits the empty-buffer-stack expect in line_ending_if_needed. A single resolver fix should close both this PR and GH-22 together.

Verified to fail against markdown = "=1.0.0" in release.

Found via in-tree fuzzing campaign.

Related-to: GH-22.
Related-to: GH-31.

This PR's existing test asserts `to_mdast("=\n=\n=\na\n=", ...)`
returns `Ok(_)`; in 1.0.0 release it panics at
`src/to_mdast.rs:189` with `"Cannot push to non-parent"`.

Adds a second assertion that the same input also panics through the
`to_html` path at `src/to_html.rs:197` with `"at least one buffer
should exist"` (the same panic site reported by wooormGH-22).

The two panic sites likely share a root cause: adjacent setext-heading
underlines confuse the resolver, which produces an Exit event without
a matching Enter; the to_mdast path hits the "Cannot push to non-parent"
assertion in tail-stack management, and the to_html path hits the
empty-buffer-stack `expect` in `line_ending_if_needed`. A single
resolver fix should close both this PR and wooormGH-22 together.

Verified to fail against `markdown = "=1.0.0"` in release.

Found via in-tree fuzzing campaign.

Related-to: wooormGH-22.
Related-to: wooormGH-31.
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.

1 participant