Add NonBlockingByteBufferParser tests for JSON-escaped surrogate pairs in field names (#1581)#1582
Merged
cowtowncoder merged 3 commits into3.xfrom Mar 27, 2026
Merged
Conversation
…#1581) Agent-Logs-Url: https://github.com/FasterXML/jackson-core/sessions/992b1156-ab87-48c5-b43d-ac52c85d9a85 Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue 1581 in jackson-core
Add NonBlockingByteBufferParser tests for JSON-escaped surrogate pairs in field names (#1581)
Mar 26, 2026
Member
|
I'll look into retargeting this at 2.21 branch to add regression testing and to see if there is an issue that exists only in the 2.x branches. |
Member
|
@pjfanning Yes: #1567 only covers blocking parser, limited and not covering async variant(s). |
Member
|
@pjfanning I could also just merge this in 3.x for improved code coverage? Let me know if that makes sense -- leaving as-is for now. |
Member
|
@cowtowncoder merge it in 3.x or 3.1 for the extra coverage. #1583 is the 2.21 equivalent but it fails. I got Copilot to draft a proposal for a fix. |
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.
NonBlockingByteBufferParserwas reported to throwInvalid UTF-8: Illegal surrogate characterwhen parsing field names containing JSON-escaped surrogate pairs (e.g.{"\\uD834\\uDd1e": 1}), while the same input worked correctly in string values and in theNonBlockingByteArrayParser.The fix from #1541 was correctly applied to
NonBlockingUtf8JsonParserBase._parseEscapedName, which is shared by bothNonBlockingByteArrayParserandNonBlockingByteBufferParservia inheritance. The gap was test coverage:AsyncEscapedSurrogateInFieldName1541Testonly exercised the ByteArray parser viaasyncForBytes(), never the ByteBuffer parser viaasyncForByteBuffer().Changes
AsyncByteBufferEscapedSurrogateInFieldName1581Testmirrors the ByteArray coverage inAsyncEscapedSurrogateInFieldName1541Testfor theNonBlockingByteBufferParser, covering:_finishPropertyWithEscape) and the inline fast pathWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
central.sonatype.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/jackson-core/jackson-core org.codehaus.plexus.classworlds.launcher.Launcher test -pl . -Dtest=AsyncEscapedSurrogateInFieldName1541Test -q(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15/bin/m2.conf -Dmaven.home=/home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15 -Dlibrary.jansi.path=/home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/jackson-core/jackson-core org.codehaus.plexus.classworlds.launcher.Launcher test -Dtest=AsyncEscapedSurrogateInFieldName1541Test -q(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/jackson-core/jackson-core org.codehaus.plexus.classworlds.launcher.Launcher test -Dtest=AsyncEscapedSurrogateInFieldName1541Test -Dmaven.parent.skip=true -q(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.