Repository navigation
MOD-17686 normalize - add overflows check - #1636
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1636 +/- ##
=======================================
Coverage 85.97% 85.97%
=======================================
Files 15 15
Lines 5306 5306
=======================================
Hits 4562 4562
Misses 744 744 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TalBarYakar
approved these changes
Aug 25, 2026
4 tasks
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.
Note
Low Risk
Small, localized change to index clamping with regression tests; fixes a panic/overflow edge case without altering normal index semantics.
Overview
Fixes undefined behavior / overflow when JSON array commands normalize negative indices at
i64::MIN, which cannot be negated in two’s complement.In
ArrayIndex::normalizefor negative indices, the PR replaces unguarded-selfwithself.saturating_neg()so extreme values clamp safely instead of wrapping. Behavior for ordinary negative indices is unchanged;i64::MINand other out-of-range values now map to sensible bounds (e.g. start index 0).Adds Rust unit tests for
i64::MIN/i64::MAXand a pytesttestArrTrimExtremeIndicescoveringJSON.ARRTRIMwith min/maxi64bounds (legacy and$.arrpaths), including empty arrays.Reviewed by Cursor Bugbot for commit 964c73a. Bugbot is set up for automated code reviews on this repo. Configure here.