Skip to content

MOD-17621 MOD-17622 Code improvements and enhancments - #1054

Merged
AvivDavid23 merged 8 commits into
8.10from
avivd_fixes_8.10
Aug 17, 2026
Merged

AvivDavid23 merged 8 commits into
8.10from
avivd_fixes_8.10

Conversation

@AvivDavid23

@AvivDavid23 AvivDavid23 commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Note

High Risk
Changes address memory-safety bugs on the RESTORE/RDB load path where malformed payloads could cause OOB access or crashes; incorrect validation could still leave exploitable load behavior.

Overview
Hardens RDB load for CMS and TopK so crafted RESTORE payloads are rejected instead of triggering overflow, out-of-bounds reads, or unsafe teardown. Patch version is bumped to 8.10.1.

In CMSRdbLoad, width/depth are now checked for multiplication overflow before sizing the counter array (aligned with NewCMSketch), and the expected buffer length uses sizeof(*cms->array).

In TopKRdbLoad, a heap blob size mismatch frees the undersized heap and sets topk->heap to NULL so TopK_Destroy on the error path does not walk stale pointers. After a valid heap load, every bucket->item is cleared before item strings are read, and a NULL item buffer from I/O fails the load.

Flow tests add TopK (truncated heap via shrunk largest module string) and CMS (fixed corrupt width/depth payload) cases that expect RESTORE to error.

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

AvivDavid23 and others added 5 commits August 13, 2026 12:33
* MOD-15410 TOPK - OOB access after restore validation cleanup

* format

* more gaurds for memory

(cherry picked from commit 5d17079)
(cherry picked from commit 7883695)
…ili fixes) (#171)

* more guards against CMS rdb load malicious payloads

* topk->heap error gaurd

* .

* Revert "topk->heap error gaurd"

This reverts commit 27454d26f492e0e4f4f68addc4cf44cadc3902b6.

(cherry picked from commit 492d15b)
(cherry picked from commit b82f8c5a48617bb2c7ee3d52502ff3bb91ea48ed)
Cherry-pick of the master pin (#1049) onto 8.10.
Moves deps/t-digest-c 5b89d70 -> daf1f4a, which brings in:

  50edef3 MOD-13821 Fix compression with total_weight=1 (#39)
  91b46bf Guard TDigest capacity calculation before integer narrowing (#41)
  21bfb00 ci: add GitHub Actions build/test + ASan/UBSan (#43)
  fddc36e test: extend td_init coverage + guard td_free(NULL) (#44)
  daf1f4a MOD-17228 Fix O(n^2) t-digest compress on duplicate input (#45)
* Fix TDigest RDB load node count overflow check

Avoid signed overflow when validating merged and unmerged node counts by widening the addition.

* Validate TDigest RDB node counts before narrowing

Load merged and unmerged node counts into int64_t locals, validate their combined capacity with an overflow-free subtraction check, and narrow only after validation. Add RESTORE regressions for both fields using values above the int range.

* Explicitly bound TDigest RDB node counts to int range

* Update t-digest-c with TDigest capacity guard

* Avoid null TDigest cleanup on RDB load failure

* Validate TopK RDB item buffers before use

* Validate TDigest RDB numeric state before conversion

* Validate Bloom RDB numeric state before narrowing

* Fix TDigest corrupt-RDB test SINT parsing

* Remove redundant TDigest RDB weight overflow check

* Validate TDigest centroid weight totals on RDB load

* Handle signed integers in corrupt RDB test helpers

* Update t-digest-c 64-bit capacity guard

Advance the t-digest-c dependency to include explicit uint64_t capacity derivation and allocation-bound validation from RedisBloom/t-digest-c#41. This addresses review feedback without changing the existing published commits.

(cherry picked from commit 9f42a26a57d88fd9331d1b577763654f5d894eb4)
(cherry picked from commit b1e82c7)
@AvivDavid23 AvivDavid23 changed the title MOD-17621 MOD-17622 Code improvements and enhancments MOD-17621 MOD-17622 8.10 Code improvements and enhancments Aug 17, 2026
@AvivDavid23 AvivDavid23 changed the title MOD-17621 MOD-17622 8.10 Code improvements and enhancments MOD-17621 MOD-17622 Code improvements and enhancments Aug 17, 2026
@sonarqubecloud

Copy link
Copy Markdown

@AvivDavid23
AvivDavid23 merged commit f25aa2f into 8.10 Aug 17, 2026
57 checks passed
@AvivDavid23
AvivDavid23 deleted the avivd_fixes_8.10 branch August 17, 2026 05:24
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