Skip to content

Reject all browser-recognized comment-closing sequences in Comment::set_text.#322

Merged
orium merged 1 commit into
mainfrom
fix-text-comment-breakout
May 29, 2026
Merged

Reject all browser-recognized comment-closing sequences in Comment::set_text.#322
orium merged 1 commit into
mainfrom
fix-text-comment-breakout

Conversation

@orium
Copy link
Copy Markdown
Member

@orium orium commented May 22, 2026

Previously Comment::set_text only rejected the canonical --> terminator, but a WHATWG-conformant browser also closes a comment on three more byte sequences:

  1. --!> anywhere in the body (comment-end-bang state).
  2. A leading > (abrupt-closing-of-empty-comment from comment-start).
  3. A leading -> (abrupt-closing-of-empty-comment from comment-start-dash).

@orium orium requested review from a team, Noah-Kennedy and jasnell as code owners May 22, 2026 19:35
@orium orium force-pushed the fix-text-comment-breakout branch from cc613c7 to c6b1c73 Compare May 22, 2026 20:17
@orium orium force-pushed the fix-text-comment-breakout branch from c6b1c73 to b7b9bf4 Compare May 26, 2026 11:04
…et_text.

Previously `Comment::set_text` only rejected the canonical `-->` terminator, but a
WHATWG-conformant browser also closes a comment on three more byte sequences:

1. `--!>` anywhere in the body (comment-end-bang state).
2. A leading `>` (abrupt-closing-of-empty-comment from comment-start).
3. A leading `->` (abrupt-closing-of-empty-comment from comment-start-dash).
@orium orium force-pushed the fix-text-comment-breakout branch from b7b9bf4 to ffcca31 Compare May 29, 2026 10:13
@orium orium merged commit ba25359 into main May 29, 2026
6 checks passed
@orium orium deleted the fix-text-comment-breakout branch May 29, 2026 10:21
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.

3 participants