Skip to content

[8.6] [MOD-13904] Don't crash when indexing negative zero ('-0.0`) integers#8382

Merged
redisearch-backport-pull-request[bot] merged 1 commit into8.6from
backport-8322-to-8.6
Feb 16, 2026
Merged

[8.6] [MOD-13904] Don't crash when indexing negative zero ('-0.0`) integers#8382
redisearch-backport-pull-request[bot] merged 1 commit into8.6from
backport-8322-to-8.6

Conversation

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request Bot commented Feb 16, 2026

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.

if ((double)tinyNum == realVal) {
// Number is small enough to fit?
header.encTiny.tinyValue = tinyNum;
header.encCommon.type = NUM_ENCODING_COMMON_TYPE_TINY;

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require 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.0 could be treated as a negative integer instead of 0, which could crash during indexing and cause inconsistent query behavior.

Adds targeted unit/integration coverage to ensure -0 and 0 are 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.

…#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)
@sonarqubecloud
Copy link
Copy Markdown

@fcostaoliveira
Copy link
Copy Markdown
Contributor

Automated performance analysis summary

This comment was automatically generated given there is performance data available.

In summary:

  • Detected a total of 5 stable tests between versions.

You can check a comparison in detail via the grafana link

##

Details

Tests with No Significant Changes (5 tests)

Tests with No Significant Changes

Test Case Baseline 8.6 (median obs. +- std.dev) Comparison backport-8322-to-8.6 (median obs. +- std.dev) % change (higher-better) Note
ftsb-10K-enwiki_abstract-hashes-term-suffix 2271 +- 0.9% (7 datapoints) 2246.0 -1.1% No Change
search-ftsb-1700K-docs-union-iterators-q3 8.0 +- 1.1% (7 datapoints) 7.8 -1.8% No Change
search-high-cardinality-negation-term-baseline 39 +- 2.3% (7 datapoints) 38.0 -1.2% No Change
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-fulltext-filter 569 +- 3.5% (7 datapoints) 541.0 -4.9% potential REGRESSION
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-tag-filter 15952 +- 1.4% (7 datapoints) 15936.0 -0.1% No Change

1 similar comment
@fcostaoliveira
Copy link
Copy Markdown
Contributor

Automated performance analysis summary

This comment was automatically generated given there is performance data available.

In summary:

  • Detected a total of 5 stable tests between versions.

You can check a comparison in detail via the grafana link

##

Details

Tests with No Significant Changes (5 tests)

Tests with No Significant Changes

Test Case Baseline 8.6 (median obs. +- std.dev) Comparison backport-8322-to-8.6 (median obs. +- std.dev) % change (higher-better) Note
ftsb-10K-enwiki_abstract-hashes-term-suffix 2271 +- 0.9% (7 datapoints) 2246.0 -1.1% No Change
search-ftsb-1700K-docs-union-iterators-q3 8.0 +- 1.1% (7 datapoints) 7.8 -1.8% No Change
search-high-cardinality-negation-term-baseline 39 +- 2.3% (7 datapoints) 38.0 -1.2% No Change
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-fulltext-filter 569 +- 3.5% (7 datapoints) 541.0 -4.9% potential REGRESSION
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-tag-filter 15952 +- 1.4% (7 datapoints) 15936.0 -0.1% No Change

@fcostaoliveira
Copy link
Copy Markdown
Contributor

fcostaoliveira commented Feb 16, 2026

Automated performance analysis summary

This comment was automatically generated given there is performance data available.

In summary:

  • Detected a total of 32 stable tests between versions.
  • Detected a total of 6 highly unstable benchmarks (6 baseline).
  • Latency analysis confirmed regressions in 2 of the unstable tests:
  • Detected a total of 5 regressions bellow the regression water line 8.0%.

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)

Test Case Baseline 8.6 (median obs. +- std.dev) Comparison backport-8322-to-8.6 (median obs. +- std.dev) % change (higher-better) Note
search-numeric 3589 +- 22.7% UNSTABLE (7 datapoints) 2159 -39.8% UNSTABLE (baseline high variance); server: FT.SEARCH p50 increased 69.2% (baseline CV=29.9%); client: Latency increased 85.2% (baseline CV=30.8%)
search-ftsb-1M-enwiki_abstract-hashes-fulltext-simple-1word-query-non-sortable 181 +- 6.4% (7 datapoints) 141 -22.2% REGRESSION
ftsb-1M-enwiki_abstract-hashes-fulltext-simple-1word-query 947 +- 10.8% UNSTABLE (7 datapoints) 741 -21.8% UNSTABLE (baseline high variance); server: FT.SEARCH p50 increased 34.7% (baseline CV=10.7%); client: OverallQuantiles.allCommands.q50 increased 36.4% (baseline CV=12.1%)
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-union-query-non-sortable 1078 +- 7.9% (7 datapoints) 903 -16.3% REGRESSION
search-filtering-tag-numeric 294 +- 8.3% (7 datapoints) 252 -14.4% waterline=8.3%. REGRESSION
search-geo 220 +- 2.1% (7 datapoints) 196 -10.8% REGRESSION
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-union-query 3090 +- 5.5% (7 datapoints) 2763 -10.6% REGRESSION
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-intersection-query 426 +- 10.3% UNSTABLE (7 datapoints) 398 -6.5% UNSTABLE (baseline high variance); server: p50 latency stable; client: OverallQuantiles.allCommands.q50 increased 6.4% (baseline CV=12.2%); neither server nor client side confirms regression
search-numeric-sortby 2230 +- 22.7% UNSTABLE (7 datapoints) 2253 1.1% UNSTABLE (baseline high variance); server: p50 latency stable; client: client latency stable; neither server nor client side confirms regression
ftsb-1M-enwiki_abstract-hashes-fulltext-2word-intersection-query-non-sortable 41 +- 18.4% UNSTABLE (7 datapoints) 45 10.9% UNSTABLE (baseline high variance); server: p50 latency stable; client: OverallQuantiles.allCommands.q50 increased 24.3% (baseline CV=10.1%); only client side confirms regression (server side stable) - insufficient evidence
search-numeric-sortby-desc 2558 +- 31.9% UNSTABLE (7 datapoints) 3768 47.3% UNSTABLE (baseline high variance); server: FT.SEARCH p50 decreased 32.9% (baseline CV=27.1%); client: Latency decreased 32.1% (baseline CV=26.4%); neither server nor client side confirms regression
Tests with No Significant Changes (32 tests)

Tests with No Significant Changes

Test Case Baseline 8.6 (median obs. +- std.dev) Comparison backport-8322-to-8.6 (median obs. +- std.dev) % change (higher-better) Note
ftsb-10K-enwiki_abstract-hashes-fulltext-sortby 91 +- 2.3% (7 datapoints) 91.00 0.4% No Change
ftsb-10K-enwiki_abstract-hashes-term-prefix 6273 +- 3.4% (7 datapoints) 6322.00 0.8% No Change
ftsb-10K-enwiki_abstract-hashes-term-suffix 2271 +- 0.9% (7 datapoints) 2246.00 -1.1% No Change
ftsb-10K-enwiki_abstract-hashes-term-suffix-withsuffixtrie 16676 +- 1.6% (7 datapoints) 16255.00 -2.5% No Change
ftsb-10K-enwiki_abstract-hashes-term-wildcard 9177 +- 5.7% (7 datapoints) 9013.00 -1.8% No Change
ftsb-10K-enwiki_pages-hashes-fulltext-mixed_simple-1word-query_write_1_to_read_20.yml 1024 +- 6.1% (7 datapoints) 955.00 -6.8% potential REGRESSION
ftsb-10K-enwiki_pages-hashes-load 63463 +- 3.8% (7 datapoints) 64065.00 0.9% No Change
ftsb-10K-multivalue-numeric-json 998 +- 2.4% (7 datapoints) 988.00 -1.0% No Change
ftsb-10K-singlevalue-numeric-json 478 +- 0.8% (7 datapoints) 483.00 1.1% No Change
ftsb-1K-enwiki_abstract-hashes-term-contains 1976 +- 0.8% (7 datapoints) 1962.00 -0.7% No Change
ftsb-1M-enwiki_abstract-hashes-load 23578 +- 2.6% (7 datapoints) 23991.00 1.8% No Change
ftsb-1M-nyc_taxis-ftadd-load 28809 +- 3.2% (7 datapoints) 30258.00 5.0% potential IMPROVEMENT
ftsb-1M-nyc_taxis-hashes-load 31272 +- 1.8% (7 datapoints) 31036.00 -0.8% No Change
search-aggregate-post-filter-simple.yml 17577 +- 0.8% (7 datapoints) 17652.00 0.4% No Change
search-filtering-tag-numeric-filter-pipeline 11030 +- 1.5% (7 datapoints) 11203.00 1.6% No Change
search-ftsb-10K-enwiki_abstract-hashes-fulltext-aggregate-sortby-limit-0-100 920 +- 1.7% (7 datapoints) 927.00 0.7% No Change
search-ftsb-10K-enwiki_abstract-hashes-fulltext-search-sortby-limit-0-100 926 +- 2.6% (7 datapoints) 922.00 -0.4% No Change
search-ftsb-10K-enwiki_abstract-hashes-term-withoutsuffix-trie 14449 +- 1.4% (7 datapoints) 14452.00 0.0% No Change
search-ftsb-10K-enwiki_abstract-hashes-term-withsuffix-trie 14380 +- 1.1% (7 datapoints) 14528.00 1.0% No Change
search-ftsb-1700K-docs-union-iterators-q3 8.0 +- 1.1% (7 datapoints) 7.80 -1.8% No Change
search-ftsb-1M-enwiki_abstract-hashes-fulltext-simple-1word-query-one-indexed-field 7252 +- 4.7% (7 datapoints) 7220.00 -0.4% No Change
search-ftsb-370K-docs-union-iterators-q4 8.3 +- 0.8% (7 datapoints) 8.10 -2.4% No Change
search-ftsb-5200K-docs-union-iterators-q1 0.83 +- 0.8% (7 datapoints) 0.83 0.0%
search-ftsb-5500K-docs-union-iterators-q2 1.2 +- 1.5% (7 datapoints) 1.20 -0.8% No Change
search-high-cardinality-negation-term-baseline 39 +- 2.3% (7 datapoints) 38.00 -1.2% No Change
search-high-cardinality-negation-term-comparison_union_all_other_terms 14 +- 2.3% (7 datapoints) 15.00 3.6% potential IMPROVEMENT
search-numeric-optimize 8205 +- 1.2% (7 datapoints) 8223.00 0.2% No Change
search-numeric-sortby-desc-optimize 31 +- 9.0% (7 datapoints) 28.00 -8.6% waterline=9.0%. potential REGRESSION
search-numeric-sortby-optimize 29 +- 4.8% (7 datapoints) 28.00 -2.0% No Change
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-fulltext-filter 569 +- 3.5% (7 datapoints) 541.00 -4.9% potential REGRESSION
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-numeric-filter 149 +- 2.4% (7 datapoints) 152.00 2.1% No Change
vecsim-arxiv-titles-384-angular-filters-m16-ef-128-tag-filter 15952 +- 1.4% (7 datapoints) 15936.00 -0.1% No Change

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.81%. Comparing base (6b65825) to head (dedf0dd).
⚠️ Report is 1 commits behind head on 8.6.

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              
Flag Coverage Δ
flow 84.79% <ø> (-0.07%) ⬇️
unit 50.53% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@redisearch-backport-pull-request redisearch-backport-pull-request Bot added this pull request to the merge queue Feb 16, 2026
Merged via the queue into 8.6 with commit ab12b48 Feb 16, 2026
85 of 109 checks passed
@redisearch-backport-pull-request redisearch-backport-pull-request Bot deleted the backport-8322-to-8.6 branch February 16, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants