Skip to content

reject lone low surrogate in StreamingMarkupWriter.write#2717

Open
netliomax25-code wants to merge 1 commit into
apache:masterfrom
netliomax25-code:streaming-markup-lone-low-surrogate
Open

reject lone low surrogate in StreamingMarkupWriter.write#2717
netliomax25-code wants to merge 1 commit into
apache:masterfrom
netliomax25-code:streaming-markup-lone-low-surrogate

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor

Repro: write a lone low surrogate (a \uDC00-\uDFFF char with no preceding high surrogate) through StreamingMarkupBuilder, e.g. new StreamingMarkupBuilder().bind { mkp.yield '\uDC00' }.
Cause: the low-surrogate branch in write(int) assumes a high surrogate was already buffered, so it reads surrogatePair.charAt(0) (the low surrogate itself) and emits a numeric character reference for an unrelated code point (\uDC00 becomes 𐀀) instead of failing.
Fix: reject a low surrogate that is not preceded by a high surrogate, matching the existing rejection of a high surrogate not followed by a low one.

@testlens-app

testlens-app Bot commented Jul 18, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 6f69bc6
▶️ Tests: 104124 executed
⚪️ Checks: 23/23 completed


Learn more about TestLens at testlens.app.

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