Skip to content

validate \U escape code point in read_escaped_char_content_helper - #1170

Merged
tgregg merged 2 commits into
amazon-ion:masterfrom
radhika1314:big-u-escape-range
Dec 3, 2026
Merged

tgregg merged 2 commits into
amazon-ion:masterfrom
radhika1314:big-u-escape-range

Conversation

@radhika1314

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

  1. a \U escape reads eight hex digits into an int, so values with the high bit set (\U80000000 through \UFFFFFFFF) wrap negative.
  2. the negative result slips past the Character.MAX_CODE_POINT guard in IonUTF8.needsSurrogateEncoding, so \UFFFFFFFF decoded to U+FFFF instead of being rejected.

added a range check on the assembled \U value in read_escaped_char_content_helper; positive out-of-range values like \U00110000 were already rejected, and \U0010FFFF still decodes.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@radhika1314

Copy link
Copy Markdown
Contributor Author

any update?

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.38%. Comparing base (3c1b6b1) to head (d7e1f45).
⚠️ Report is 172 commits behind head on master.

Files with missing lines Patch % Lines
...a/com/amazon/ion/impl/IonReaderTextRawTokensX.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1170      +/-   ##
============================================
+ Coverage     67.23%   68.38%   +1.15%     
- Complexity     5484     5749     +265     
============================================
  Files           159      160       +1     
  Lines         23025    23510     +485     
  Branches       4126     4239     +113     
============================================
+ Hits          15481    16078     +597     
+ Misses         6262     6133     -129     
- Partials       1282     1299      +17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tgregg tgregg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tgregg
tgregg merged commit d5070c0 into amazon-ion:master Dec 3, 2026
31 of 37 checks passed
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