[8.6] [MOD-13904] Don't crash when indexing negative zero ('-0.0`) integers#8382
Conversation
…#8322) * Handle negative zero encoding as tiny integer Fixes an issue where negative zero (-0.0) was incorrectly encoded as IntegerNegative instead of TinyInteger(0). The fix checks for tiny integer range before checking the sign, ensuring negative zero is properly encoded as TinyInteger(0). * Add a roundtrip test for negative numbers * Add roundtrip unit tests for 0.0 and -0.0 numbers * Correctly set in cluster (cherry picked from commit eb0de2e)
|
Automated performance analysis summaryThis comment was automatically generated given there is performance data available. In summary:
You can check a comparison in detail via the grafana link ## DetailsTests with No Significant Changes (5 tests)Tests with No Significant Changes
|
1 similar comment
Automated performance analysis summaryThis comment was automatically generated given there is performance data available. In summary:
You can check a comparison in detail via the grafana link ## DetailsTests with No Significant Changes (5 tests)Tests with No Significant Changes
|
Automated performance analysis summaryThis comment was automatically generated given there is performance data available. In summary:
You can check a comparison in detail via the grafana link Performance Regressions and Issues - Comparison between 8.6 and backport-8322-to-8.6.Time Period from a month ago. (environment used: oss-standalone)
Tests with No Significant Changes (32 tests)Tests with No Significant Changes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.6 #8382 +/- ##
==========================================
- Coverage 83.85% 83.81% -0.04%
==========================================
Files 367 367
Lines 55553 55559 +6
Branches 14296 14302 +6
==========================================
- Hits 46584 46567 -17
- Misses 8808 8831 +23
Partials 161 161
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|



Description
Backport of #8322 to
8.6.Describe the changes in the pull request
Fixes an issue where negative zero (-0.0) was incorrectly encoded as IntegerNegative instead of TinyInteger(0). The fix checks for tiny integer range before checking the sign, ensuring negative zero is properly encoded as TinyInteger(0).
This makes it match the old C code which also encoded it as a tiny integer.
RediSearch/src/inverted_index/inverted_index.c
Lines 431 to 434 in 0b21dc5
Mark if applicable
Release Notes
If a release note is required (bug fix / new feature / enhancement), describe the user impact of this PR in the title.
Note
Low Risk
Small, localized change to numeric encoding for a single edge case (
-0.0), with added tests to prevent regressions.Overview
Fixes an edge case in numeric value encoding where
-0.0could be treated as a negative integer instead of0, which could crash during indexing and cause inconsistent query behavior.Adds targeted unit/integration coverage to ensure
-0and0are encoded identically and return the same results in JSON numeric range queries.Written by Cursor Bugbot for commit dedf0dd. This will update automatically on new commits. Configure here.