Repository navigation
Let an unclosed comment skip only later comment scans - #633
Open
yuxi-liu-wired wants to merge 1 commit into
Open
yuxi-liu-wired wants to merge 1 commit into
yuxi-liu-wired wants to merge 1 commit into
Conversation
When `<!--` has no closing `-->` before the end of the input,
FLAG_SKIP_HTML_COMMENT is set so later `<!--` don't rescan. The flag was
checked before any `<!` construct, so it also stopped declarations and
CDATA sections after the unclosed comment:
a <!-- x <!B> <![CDATA[y]]> c
rendered `<!B>` and the CDATA section as text. Check the flag only where
the comment scan runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
<!--has no closing-->before the end of the input,FLAG_SKIP_HTML_COMMENTis set so that later<!--don't rescan the rest of the input. The flag was checked before any<!construct, so after an unclosed comment it also stopped declarations and CDATA sections:cmark renders
<!B>and the CDATA section as text:commonmark.js (and pulldown-cmark) keep both as raw HTML:
<p>a <!-- x <!B> <![CDATA[y]]> c</p>.The fix checks the flag only where the comment scan runs. The
<!-->and<!--->forms need no scan and are unaffected; the "unclosed <!--" pathological test still passes.Test: a new example in
test/regression.txt, after the declaration examples. It fails on master and passes with the change. Spec 652/652, pathological 25/25.Found by differential fuzzing of pulldown-cmark against cmark, with commonmark.js as tie-breaker.