Repository navigation
MOD-17621 MOD-17622 Code improvements and enhancments - #1054
Merged
Merged
Conversation
…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)
gabsow
approved these changes
Aug 17, 2026
|
gabsow
approved these changes
Aug 17, 2026
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
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
RESTOREpayloads 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 withNewCMSketch), and the expected buffer length usessizeof(*cms->array).In
TopKRdbLoad, a heap blob size mismatch frees the undersized heap and setstopk->heapto NULL soTopK_Destroyon the error path does not walk stale pointers. After a valid heap load, everybucket->itemis 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
RESTOREto error.Reviewed by Cursor Bugbot for commit 73104fc. Bugbot is set up for automated code reviews on this repo. Configure here.