Skip to content

reject ?> and -- in markup builder pi and comment output#2625

Closed
netliomax25-code wants to merge 1 commit into
apache:masterfrom
netliomax25-code:markup-pi-comment-terminator
Closed

reject ?> and -- in markup builder pi and comment output#2625
netliomax25-code wants to merge 1 commit into
apache:masterfrom
netliomax25-code:markup-pi-comment-terminator

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor
  1. AbstractStreamingBuilder.toMapStringClosure builds processing-instruction pseudo-attributes by writing each name and value straight into the <?...?> body, so a value holding ?> closes the PI early and injects sibling markup. This closure backs both StreamingMarkupBuilder and StreamingDOMBuilder.
  2. MarkupBuilderHelper.comment wraps its text in <!-- ... --> through yieldUnescaped, so text holding -- closes the comment early the same way.

Entity escaping is not legal inside a processing instruction or comment, so the terminating sequence is rejected (?> for the PI data, -- for the comment text) rather than escaped. The builders already escape element text and attribute values, these two bodies were the gap. Regression test added for both, plus a check that ordinary PI/comment content still round-trips.

@paulk-asert

Copy link
Copy Markdown
Contributor

Merged as part of #2626. Thanks!

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.

2 participants