Bug fix for issue 745 : Fix string duplication on escaped chunk boundaries#746
Merged
Merged
Conversation
Member
|
Hi @dwalend, thanks for reporting and proposing a fix for this. I will look into this change later today. |
Author
|
Thanks! Let me know if you want me to make any changes. |
satabin
reviewed
Mar 11, 2026
satabin
left a comment
Member
There was a problem hiding this comment.
Just two small comments on the test, otherwise LGTM. Thanks a lot for spotting this.
Author
|
Both changes are in. Thanks again for taking up my bug. Let me know if you want any other changes. I've got an AI shaggy dog story to go with it. ("The left coprocessor does not know what the right coprocessor is up to.") |
satabin
approved these changes
Mar 13, 2026
Member
|
Thanks for the contribution. I will merge it and backport it to release 1.12.1 with this fix immediately. |
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.
Bug #745
tokens[F, String]has the same chunk-boundary escape duplication bug as #515Description
Issue #515 (fixed in 1.8.1 by commit 18a8ce2) fixed a bug where chunk boundaries falling inside JSON escape sequences caused string content duplication. The fix added
T.mark(context)inslowString_(the slow path) after seeing a backslash, but missed the identical pattern instring_(the fast path) at line 55-58.When the fast-path
string_encounters a backslash, it callsappendMarked,advance, then entersslowString_-- but without callingmarkfirst. If the chunk boundary falls right after the backslash,slowString_callsappendMarkedagain using the stale mark position, re-appending already-consumed content.This affects
tokens[F, String]because String chunks are typically small (one per emit). The original #515 test usedtokens[F, Byte]withchunkLimit(55), which happened to align chunks differently and not hit the fast-path code.Fix
One line -- add
T.mark(context)instring_after seeing a backslash, matching whatslowString_already does:PR with fix and tests: closes #745.