Skip to content

MOD-17686 normalize - add overflows check - #1636

Merged
AvivDavid23 merged 2 commits into
masterfrom
MOD-17686-ARRAYTRIM-normalize
Aug 25, 2026
Merged

AvivDavid23 merged 2 commits into
masterfrom
MOD-17686-ARRAYTRIM-normalize

Conversation

@AvivDavid23

@AvivDavid23 AvivDavid23 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

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::normalize for negative indices, the PR replaces unguarded -self with self.saturating_neg() so extreme values clamp safely instead of wrapping. Behavior for ordinary negative indices is unchanged; i64::MIN and other out-of-range values now map to sensible bounds (e.g. start index 0).

Adds Rust unit tests for i64::MIN / i64::MAX and a pytest testArrTrimExtremeIndices covering JSON.ARRTRIM with min/max i64 bounds (legacy and $.arr paths), including empty arrays.

Reviewed by Cursor Bugbot for commit 964c73a. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.97%. Comparing base (21568f4) to head (964c73a).
⚠️ Report is 1 commits behind head on master.

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.
📢 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.

@AvivDavid23
AvivDavid23 merged commit 1c74f65 into master Aug 25, 2026
59 checks passed
@AvivDavid23
AvivDavid23 deleted the MOD-17686-ARRAYTRIM-normalize branch August 25, 2026 12:04
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