Reject corrupt stream RDB with shared NACK across consumers#15081
Merged
sggeorgiev merged 7 commits intoredis:unstablefrom Apr 23, 2026
Merged
Reject corrupt stream RDB with shared NACK across consumers#15081sggeorgiev merged 7 commits intoredis:unstablefrom
sggeorgiev merged 7 commits intoredis:unstablefrom
Conversation
sundb
reviewed
Apr 22, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit e9bd224. Configure here.
Collaborator
|
Pls check if we need to backport it to a version older than 8.6. |
sundb
reviewed
Apr 23, 2026
Co-authored-by: debing.sun <debing.sun@redis.com>
sundb
approved these changes
Apr 23, 2026
YaacovHazan
pushed a commit
that referenced
this pull request
Apr 28, 2026
**Summary** Detects and rejects corrupt stream RDB payloads where the same NACK (pending entry) is referenced by more than one consumer, which violates a stream data-structure. **Changes** - **`rdbLoadObject` (stream consumer PEL loading)**: Added a guard that checks `nack->consumer != NULL` before assigning the consumer pointer. When a second consumer's PEL references a NACK that was already claimed by a prior consumer, the loader now reports a corrupt RDB error and aborts instead of silently overwriting the pointer. Without this check, two consumers share the same `streamNACK`, and freeing the first consumer's PEL leaves the second with a dangling pointer. - **`corrupt-dump.tcl`**: Added a regression test that crafts a stream with two consumers (`consumerA`, `consumerB`) whose PELs both reference the same entry (`1-0`). The `RESTORE` command is expected to fail with `"Bad data format"`, and the server must remain responsive (`PING` succeeds). **Benefits** - **Fail-fast on corrupt data**: The invariant violation is caught at load time with a clear diagnostic message rather than manifesting as a crash later during normal operation. - **Regression coverage**: The crafted payload in the test ensures this class of corruption is permanently guarded against.
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.

Summary
Detects and rejects corrupt stream RDB payloads where the same NACK (pending entry) is referenced by more than one consumer, which violates a stream data-structure.
Changes
rdbLoadObject(stream consumer PEL loading): Added a guard that checksnack->consumer != NULLbefore assigning the consumer pointer. When a second consumer's PEL references a NACK that was already claimed by a prior consumer, the loader now reports a corrupt RDB error and aborts instead of silently overwriting the pointer. Without this check, two consumers share the samestreamNACK, and freeing the first consumer's PEL leaves the second with a dangling pointer.corrupt-dump.tcl: Added a regression test that crafts a stream with two consumers (consumerA,consumerB) whose PELs both reference the same entry (1-0). TheRESTOREcommand is expected to fail with"Bad data format", and the server must remain responsive (PINGsucceeds).Benefits
Note
Medium Risk
Adds stricter validation during stream RDB/RESTORE loading; mistakes could cause previously-loadable (but corrupt) dumps to be rejected, and it touches stream consumer-group persistence logic that can affect load paths.
Overview
Prevents loading corrupt stream consumer-group state where multiple consumers reference the same global PEL
streamNACK. DuringrdbLoadObjectstream consumer PEL loading, it now fails fast if a resolvedstreamNACKalready has aconsumerset, instead of overwriting the pointer.Adds an integration regression test that restores a crafted stream payload with a NACK shared by two consumers and asserts
RESTOREfails withBad data formatwhile the server remains responsive.Reviewed by Cursor Bugbot for commit 3ce48f9. Bugbot is set up for automated code reviews on this repo. Configure here.