Repository navigation
Reject malformed UTF-8 sequences in read_ut8_sequence - #1169
Merged
Merged
Conversation
Contributor
Author
|
any update? |
tgregg
force-pushed
the
utf8-sequence-validation
branch
from
December 2, 2026 23:25
1c9313c to
9691d34
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1169 +/- ##
============================================
+ Coverage 67.23% 68.37% +1.14%
- Complexity 5484 5744 +260
============================================
Files 159 160 +1
Lines 23025 23509 +484
Branches 4126 4238 +112
============================================
+ Hits 15481 16075 +594
+ Misses 6262 6133 -129
- Partials 1282 1301 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tgregg
approved these changes
Dec 3, 2026
tgregg
left a comment
Contributor
There was a problem hiding this comment.
Looks good, thanks for the contribution!
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.
Issue #, if available: N/A
Description of changes:
read_ut8_sequenceassembles a multi-byte sequence without checking that the bytes after the lead byte are continuation bytes, and without rejecting non-shortest forms, so a truncated lead byte inside a quoted string or symbol consumes whatever comes next, including the closing quote:["\xC3"x","c"]reads as a two element list rather than being rejected. An overlong form decodes to the character it encodes, so{path:"..\xE0\x80\xAF.."}reads as{path:"../.."}with no0x2Fbyte anywhere in the input, which means a byte level check and the parser can disagree about the same document. The binary reader already rejects both of these in itsCharsetDecoder, so this validates each continuation byte and bounds the decoded scalar by the sequence length to match it.Two notes on the diff: the expected message in
IonExceptionTest.testCauseOfWrongEncodingchanged because that input ('1\xF5111') now fails on the bad continuation byte instead of later on the out of range scalar, andspotlessApplyrewrote that file's license header on the way through. UTF-8 encoded surrogate pairs are left alone sincetestSurrogateGluingcovers them deliberately.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.