Conversation
* fix: correctly parse `i128::MIN` from text Ion The text Ion parser rejected `i128::MIN` (`-170141183460469231731687303715884105728`) as out of range, even though it is a valid `i128` value. This happened because the parser stripped the sign, parsed the magnitude as `i128`, then negated. Since the magnitude of `i128::MIN` is `i128::MAX + 1`, parsing it as `i128` failed. Fixed by parsing the magnitude as `u128` with proper range validation, then using `wrapping_neg()` to correctly convert to the negative `i128` value. Added boundary value tests for `i32`, `i64`, and `i128` min/max values. * test: add overflow tests for `i128` boundary parsing Add `read_ints_overflow` test to verify the parser correctly rejects integers outside the `i128` range: - `i128::MAX + 1` (positive overflow) - `i128::MIN - 1` (negative overflow)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1018 +/- ##
==========================================
+ Coverage 78.33% 78.36% +0.02%
==========================================
Files 138 138
Lines 34188 34232 +44
Branches 34188 34232 +44
==========================================
+ Hits 26781 26825 +44
+ Misses 5345 5344 -1
- Partials 2062 2063 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tgregg
approved these changes
Jan 5, 2026
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.
The text Ion parser rejected
i128::MIN(-170141183460469231731687303715884105728) as out of range, even though it is a validi128value. This happened because the parser stripped the sign, parsed the magnitude asi128, then negated. Since the magnitude ofi128::MINisi128::MAX + 1, parsing it asi128failed.Fixed by parsing the magnitude as
u128with proper range validation, then usingwrapping_neg()to correctly convert to the negativei128value.Added boundary value tests for
i32,i64, andi128min/max values.Add
read_ints_overflowtest to verify the parser correctly rejects integers outside thei128range:i128::MAX + 1(positive overflow)i128::MIN - 1(negative overflow)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.