Repository navigation
MOD-16653 Prevent more heap overflow + other rdb load asserions (#2086) - #2168
Merged
Merged
Conversation
|
gabsow
approved these changes
Sep 14, 2026
gabsow
left a comment
Collaborator
There was a problem hiding this comment.
Approved.
Reviewed mechanically rather than by eyeball: 3-way-applied master b54cdcef onto this base and diffed the result against the PR head, so what I actually reviewed is the human conflict resolution.
src/compressed_chunk.candsrc/rdb.chunks are byte-identical to master.- The follow-up commit
test: assert corrupted DUMP restore errorsstrengthens the tests relative to master:.error()→.error().contains("Bad data format")on all three new tests, and the hard-coded RDB payload replaced by one generated from a liveDUMP. Nothing weakened anywhere in the stack. - This branch's
series_rdb_savefield order matches the test's manual RDB parser; compressed-chunk field order andSERIES_OPT_COMPRESSED_GORILLA == 2confirmed on-branch. - No conflict markers, the test file byte-compiles, and all five
_rdb_*helpers are defined exactly once.
Red legs, neither caused by this change:
build-linux-x64 / x64-bullseye— infra. Debian 11 moved to archive, sodeb.debian.org/debian-security bullseye-security404s for every package. Branch-independent; it reddens every open PR until CI pinsarchive.debian.orgor drops bullseye.- SonarCloud —
40.9% Duplication on New Code(gate requires ≤3%), from the ~45-line field-walking preamble shared by_patch_first_compressed_chunk_misalign_sizeand_patch_first_compressed_chunk_count. Inherited from #2086, not introduced here.
Non-blocking follow-up: master #2086 still carries the hard-coded payload and the bare .error(), so master is now behind its own backports. Worth forward-porting the follow-up commit so the next sync doesn't conflict.
Note the rest of CI is still running as I approve; I'm watching the stack and will flag any red leg that isn't red on its own base branch.
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 sit on the untrusted RDB/RESTORE input path; incorrect validation could break legitimate restores, but the edits are additive rejections of malformed metadata rather than new decode logic.
Overview
Hardens RESTORE/RDB loading against crafted DUMP payloads that could previously pass partial checks and trigger heap issues in Gorilla decompression.
Compressed_LoadFromRDBnow rejects compressed chunks whensize≠ loaded buffer length, whensizeis not 8-byte aligned (Gorilla word access), and whencountis inconsistent withidxusingidx/2 < count - 1so hugecountvalues cannot bypass the check via overflow. Series load inrdb.calso requireschunkSizeBytesto be non-zero and a multiple of 8.Flow tests patch valid
DUMPoutputs (with CRC repair and RDB length re-encoding) to assert "Bad data format" for size/length mismatch, misaligned buffers, and inflatedcount(including near-UINT64_MAXbypass cases).Reviewed by Cursor Bugbot for commit 1f8968c. Bugbot is set up for automated code reviews on this repo. Configure here.