Repository navigation
Harden stream validation on RDB load against crafted metadata - #3922
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR extends stream listpack validation to count live entries and reject negative counts. RDB loading rejects streams whose declared length differs from the validated count. Integration tests cover malformed stream payloads. ChangesStream length validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RDBLoader as RDB Loader
participant Validator as streamValidateListpackIntegrity
participant StreamMetadata as Stream Metadata
RDBLoader->>Validator: validate listpack and count live entries
Validator-->>RDBLoader: return validation status
RDBLoader->>StreamMetadata: read declared stream length
RDBLoader->>RDBLoader: compare declared length with valid_entries
RDBLoader-->>RDBLoader: reject corrupt payload on mismatch
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
❌ Provenance Check AlertPotential code similarities detected with upstream repository.
This check was performed automatically by the Provenance Guard Action. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #3922 +/- ##
============================================
- Coverage 78.55% 78.54% -0.02%
============================================
Files 166 166
Lines 88285 88292 +7
============================================
- Hits 69352 69346 -6
- Misses 18933 18946 +13
🚀 New features to boost your workflow:
|
a33c522 to
3bba307
Compare
❌ Provenance Check AlertPotential code similarities detected with upstream repository.
This check was performed automatically by the Provenance Guard Action. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/stream.h (1)
151-151: ⚡ Quick winDocument the new
valid_countcontract at the declaration.Line 151 adds a non-obvious out-parameter; please document that it is optional (
NULLallowed) and that it accumulates live/non-deleted entries so callers don't mis-handle it.Suggested header update
+/* Validate stream listpack integrity. If `valid_count` is not NULL, add this + * listpack's non-deleted entry count to `*valid_count`. */ int streamValidateListpackIntegrity(unsigned char *lp, size_t size, uint64_t *valid_count);As per coding guidelines "Document why code exists, not just what it does; document all functions in C code".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/stream.h` at line 151, The declaration for streamValidateListpackIntegrity adds a non-obvious out-parameter; update the function comment above streamValidateListpackIntegrity(unsigned char *lp, size_t size, uint64_t *valid_count) to document that valid_count may be NULL (optional) and, when non-NULL, the function will accumulate/return the count of live (non-deleted) entries found during validation so callers handle it correctly; mention the units (number of entries) and that the parameter is an out-accumulator rather than an input.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/stream.h`:
- Line 151: The declaration for streamValidateListpackIntegrity adds a
non-obvious out-parameter; update the function comment above
streamValidateListpackIntegrity(unsigned char *lp, size_t size, uint64_t
*valid_count) to document that valid_count may be NULL (optional) and, when
non-NULL, the function will accumulate/return the count of live (non-deleted)
entries found during validation so callers handle it correctly; mention the
units (number of entries) and that the parameter is an out-accumulator rather
than an input.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f56ae99-681b-4162-a6f3-c2cd7f66369e
📒 Files selected for processing (4)
src/rdb.csrc/stream.hsrc/t_stream.ctests/integration/corrupt-dump.tcl
🚧 Files skipped from review as they are similar to previous changes (2)
- src/t_stream.c
- src/rdb.c
Two crafted-RESTORE crashes in stream loading, both where the payload passes
the existing structural validation but violates an invariant that downstream
code relies on:
1. Length vs. tombstones: a stream can claim a positive length while every
listpack entry is a tombstone (STREAM_ITEM_FLAG_DELETED). The length is
loaded directly from the payload and only checked against the rax being
non-empty, so the mismatch is accepted. streamLastValidID() then finds no
non-tombstone entry while s->length is non-zero and aborts via serverPanic
("Corrupt stream, length is N, but no max id") on XSETID/XADD/XREADGROUP.
Fix: streamValidateListpackIntegrity() already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream, which can hit entry-level assertions on other malformed payloads.
2. Negative field counts: a master entry (or a per-entry field count for
non-SAMEFIELDS entries) can declare a negative number of fields. The
validator only checked lpGetIntegerIfValid()'s success flag, not the sign.
A negative count is then used to drive listpack traversal in
streamIteratorGetID(), walking past the listpack and asserting
(listpack.c lpAssertValidEntry) on XRANGE and similar reads.
Fix: reject negative primary_fields and per-entry fields counts during
validation.
Both are remotely triggerable crashes for any client with RESTORE access.
Add corrupt-dump integration tests covering both via the RESTORE path.
Signed-off-by: Madelyn Olson <[email protected]>
3bba307 to
b06b71d
Compare
The negative deleted count guard added in the previous commit was untested. Cover it with a payload where the negative count is not caught incidentally by later validation: entry_count 3 with deleted_count -2 bounds the entry loop at 1, matching the single entry actually present, so the listpack walks cleanly to the end and validation returns valid. Without the sign check RESTORE accepts the payload, leaving a master entry count of 3 for a listpack holding one entry. Verified the test fails when the deleted_count < 0 check is reverted. Signed-off-by: Madelyn Olson <[email protected]>
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
## Problem
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
### 1. Length vs. tombstones
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
### 2. Negative field counts
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
## Fix
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
## Testing
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Backport-Source-PR: 3922
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Backport-Source-PR: 3922
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Backport-Source-PR: 3922
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Backport-Source-PR: 3922
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
Backport-Source-PR: 3922
## Problem
Two crafted-`RESTORE` crashes in stream loading. In both, the payload
passes the existing structural validation but violates an invariant
downstream code relies on. **Any client with `RESTORE` access can
remotely crash the server.**
### 1. Length vs. tombstones
A stream can claim a positive `length` while every listpack entry is a
tombstone (`STREAM_ITEM_FLAG_DELETED`). The length is loaded directly
from the payload and only checked against the rax being non-empty.
`streamLastValidID()` then finds no non-tombstone entry while
`s->length` is non-zero and aborts:
```
serverPanic("Corrupt stream, length is %llu, but no max id", ...) // t_stream.c
```
Triggered by `XSETID` / `XADD` / `XREADGROUP`. Confirmed: a 2-entry
stream with both entries flagged `DELETED` and `length=1` loads OK, then
`XSETID` panics.
### 2. Negative field counts
A master entry (or a per-entry field count for non-`SAMEFIELDS` entries)
can declare a **negative** number of fields. The validator only checked
`lpGetIntegerIfValid()`'s success flag, not the sign. The negative count
drives listpack traversal in `streamIteratorGetID()`, walking past the
listpack and asserting (`lpAssertValidEntry`) on `XRANGE` and similar
reads. Confirmed: crafted payload loads OK, then `XRANGE` aborts at
`listpack.c`.
## Fix
1. `streamValidateListpackIntegrity()` already parses each listpack's
master entry count (live entries). Sum it across listpacks via a new
out-parameter and reject the payload if it does not match the loaded
length. This reuses the assertion-safe parsing rather than iterating the
stream with `streamIteratorGetID()`, which can itself hit entry-level
assertions on *other* malformed payloads (an earlier iterate-based
version regressed three existing corrupt-dump tests).
2. Reject negative `primary_fields` and per-entry `fields` counts during
validation.
## Testing
- Two `RESTORE`-path integration tests in
`tests/integration/corrupt-dump.tcl`.
- Both verified to **fail pre-fix** (panic / assert) and **pass
post-fix**.
- Confirmed legitimate streams — including ones with real tombstones (5
entries, 2 deleted) and multi-field entries — still load and read
correctly.
- Full `integration/corrupt-dump` suite: 75 passed, 0 failed (including
the three stream consumer-group tests an earlier iterate-based approach
broke).
> [!NOTE]
> Found via structure-aware fuzzing + code review of the RESTORE path.
This issue was generated by AI but verified, with love, by a human.
---------
Signed-off-by: Madelyn Olson <[email protected]>
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [valkey/valkey](https://github.com/valkey-io/valkey) | patch | `9.1.1` → `9.1.2` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/6) for more information. --- ### Release Notes <details> <summary>valkey-io/valkey (valkey/valkey)</summary> ### [`v9.1.2`](https://github.com/valkey-io/valkey/releases/tag/9.1.2) [Compare Source](valkey-io/valkey@9.1.1...9.1.2) ## Valkey 9.1.2 - Released Mon 31 August 2026 Upgrade urgency SECURITY: This release includes security fixes we recommend you apply as soon as possible. ##### Security Fixes - GHSA-jcj7-v34w-v9vv: Fix a use-after-free in RDMA connection handling that could allow an authenticated client to crash the server using CLIENT KILL. Only affects servers built with USE\_RDMA and configured with an RDMA listener ([#​4534](valkey-io/valkey#4534)) - GHSA-fq2f-crmw-q97r: Fix an unauthenticated use-after-free of the Lua interpreter state, caused by a process-global script debugger command table that cached a raw pointer to a freed interpreter and was never invalidated ([#​4574](valkey-io/valkey#4574)) ##### Bug Fixes - Fix a double-free crash when a module timer callback stops its own timer with `ValkeyModule_StopTimer` by [@​quanyeyang](https://github.com/quanyeyang) ([#​4211](valkey-io/valkey#4211)) - Fix torn RESP3 push frames when a client publishes to a channel it is also subscribed to, which could desync client libraries by [@​quanyeyang](https://github.com/quanyeyang) ([#​4253](valkey-io/valkey#4253)) - Listpacks are now always validated on RDB load and RESTORE, preventing deferred assertion crashes; `sanitize-dump-payload` and its ACL flags become no-ops by [@​jjuleslasarte](https://github.com/jjuleslasarte) ([#​3721](valkey-io/valkey#3721)) - Fix crashes, hangs, and CPU spinning when the RDMA transport is used together with I/O threads by [@​quanyeyang](https://github.com/quanyeyang) ([#​3611](valkey-io/valkey#3611)) - RESET now clears the `CLIENT IMPORT-SOURCE` flag, so reused pooled connections return to normal expiration semantics by [@​tjade273](https://github.com/tjade273) ([#​3973](valkey-io/valkey#3973)) - Truncate a partially written MULTI block from the AOF on short read, preventing loss of newer writes after a later restart by [@​chzhoo](https://github.com/chzhoo) ([#​4342](valkey-io/valkey#4342)) - Fix an ACL bypass where duplicate STORE/STOREDIST options let GEORADIUS write or delete keys outside the user's permitted patterns by [@​tjade273](https://github.com/tjade273) ([#​3971](valkey-io/valkey#3971)) - Fix command log redaction leaking between commands in a MULTI transaction and missing for commands executed from scripts by [@​madolson](https://github.com/madolson) ([#​4323](valkey-io/valkey#4323)) - Fix a use-after-free crash when a module's cluster message type is received after the module is unloaded by [@​enjoy-binbin](https://github.com/enjoy-binbin) ([#​4360](valkey-io/valkey#4360)) - Fix out-of-bounds access for cluster module message type 255, which is now a valid, dispatchable message type by [@​enjoy-binbin](https://github.com/enjoy-binbin) ([#​4410](valkey-io/valkey#4410)) - AOF loading no longer performs ACL checks on replayed commands, preventing silent data loss when the default user is disabled by [@​lukepalmer](https://github.com/lukepalmer) ([#​3984](valkey-io/valkey#3984)) - Fix a client memory accounting leak on replicas that inflated the `mem_clients_normal` INFO field after primary disconnections by [@​enjoy-binbin](https://github.com/enjoy-binbin) ([#​4395](valkey-io/valkey#4395)) - Fix a permanent client deadlock when a blocking command like BLPOP is followed by a partially delivered pipelined command by [@​foobar](https://github.com/foobar) ([#​4531](valkey-io/valkey#4531)) - HGETEX now requires write permission on the key, closing an ACL gap that let read-only users change field TTLs or delete fields by [@​ranshid](https://github.com/ranshid) ([#​4576](valkey-io/valkey#4576)) - Compare the whole TLS certificate CN during authentication, so an embedded NUL can no longer impersonate another ACL user by [@​madolson](https://github.com/madolson) ([#​4577](valkey-io/valkey#4577)) - Fix atomic slot migration failures with I/O threads by not offloading the export job's writes while snapshotting by [@​satheeshaGowda](https://github.com/satheeshaGowda) ([#​4104](valkey-io/valkey#4104)) - Reject invalid slot import ranges when loading an RDB, so corrupted files can no longer create bad migration jobs by [@​enjoy-binbin](https://github.com/enjoy-binbin) ([#​4229](valkey-io/valkey#4229)) - Reject RDB slot import records with an invalid job name length, preventing an out-of-bounds read at startup by [@​quanyeyang](https://github.com/quanyeyang) ([#​4210](valkey-io/valkey#4210)) - MOVE and COPY now check ACL access to the current database, so users can no longer exfiltrate keys from an unauthorized DB by [@​cjx-zar](https://github.com/cjx-zar) ([#​4155](valkey-io/valkey#4155)) - Fix a crash on COPY with a trailing DB option during slot migration, and block cross-DB COPY regardless of option order by [@​madolson](https://github.com/madolson) ([#​4301](valkey-io/valkey#4301)) - Fix a server panic when pipelined commands with invalid arity reach the key prefetcher with I/O threads enabled by [@​madolson](https://github.com/madolson) ([#​4302](valkey-io/valkey#4302)) - HPERSIST, HTTL, HPTTL, HEXPIRETIME, and HPEXPIRETIME now return a syntax error when the FIELDS keyword is missing by [@​cjx-zar](https://github.com/cjx-zar) ([#​4300](valkey-io/valkey#4300)) - Fix a race between TLS I/O-thread writes and reads that could leave slot migration export jobs stuck until timeout by [@​jjuleslasarte](https://github.com/jjuleslasarte) ([#​4320](valkey-io/valkey#4320)) - Fix a signed overflow that let very large hash field expiration times (e.g. via HPEXPIREAT) crash the server by [@​ranshid](https://github.com/ranshid) ([#​4312](valkey-io/valkey#4312)) - Fix a frozen monotonic clock on hosts with unsynchronized TSC that stopped background tasks and key expiration by [@​quanyeyang](https://github.com/quanyeyang) ([#​4346](valkey-io/valkey#4346)) - Fix a stack overflow crash when retrying a failed TLS write with a large reply by [@​murphyjacob4](https://github.com/murphyjacob4) ([#​4307](valkey-io/valkey#4307)) - Fix the `--check-system` clocksource check to skip hosts using a hardware clock and suggest only actually available clocksources by [@​quanyeyang](https://github.com/quanyeyang) ([#​4272](valkey-io/valkey#4272)) - Fix an assertion failure with I/O threads when a blocked client's pending command was processed again before unblocking by [@​quanyeyang](https://github.com/quanyeyang) ([#​4376](valkey-io/valkey#4376)) - Sentinel no longer loads the built-in Lua scripting engine, removing a spurious warning at startup by [@​enjoy-binbin](https://github.com/enjoy-binbin) ([#​4327](valkey-io/valkey#4327)) - Validate channel, message, and module payload lengths in cluster bus packets, preventing forged packets from crashing nodes by [@​tjade273](https://github.com/tjade273) ([#​3972](valkey-io/valkey#3972)) - Harden stream validation on RDB load and RESTORE so crafted payloads can no longer crash the server on later commands by [@​madolson](https://github.com/madolson) ([#​3922](valkey-io/valkey#3922)) - Reject stream payloads with mismatched live/deleted record counts, preventing XDEL from destroying unaccounted entries by [@​roshkhatri](https://github.com/roshkhatri) ([#​4381](valkey-io/valkey#4381)) - Skip unnecessary post-read processing with I/O threads on socket and TLS connections, restoring small-payload throughput by [@​quanyeyang](https://github.com/quanyeyang) ([#​4401](valkey-io/valkey#4401)) - Fix a use-after-free crash when serving clients blocked on the same key if one client is freed during processing by [@​quanyeyang](https://github.com/quanyeyang) ([#​4212](valkey-io/valkey#4212)) - Avoid an unneeded client lookup per write completion with I/O threads on socket and TLS connections, improving pipelined throughput by [@​dgershko](https://github.com/dgershko) ([#​4440](valkey-io/valkey#4440)) - Fix CLUSTER SLOT-STATS ORDERBY returning wrong ordering when slot counters differ by more than 2^31 by [@​jzy1688](https://github.com/jzy1688) ([#​4459](valkey-io/valkey#4459)) - Fix slot migration failures with I/O threads and TLS by keeping the export job's ACK reads on the main thread while snapshotting by [@​satheeshaGowda](https://github.com/satheeshaGowda) ([#​4559](valkey-io/valkey#4559)) **Full Changelog**: <valkey-io/valkey@9.1.1...9.1.2> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNC4zIiwidXBkYXRlZEluVmVyIjoiNDQuMTQuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://forge.superkooka.com/Superkooka/infra-gitops/pulls/31
> [!NOTE] > **Opened ready despite 5 flagged items** (`force_ready` was set): model declined to note some included PRs; notes flagged low-confidence; release-safety guardrail overrode AI triage; AI triaged PRs without release-notes (confirm include/exclude); notes with an unconfirmed cherry-pick origin. Review the sections below and confirm before merging. Cuts **7.2.15** onto release line `7.2`. - Promotes the release notes into a dated section, bumps `src/version.h`, and refreshes the running contributor list. - Release notes computed over the range below (`7.2.14..b533888`): ``` mode: ga source_ref: 7.2 target_branch: 7.2 base: 7.2.14 @ 499cfb9 head: b533888 @ b533888 ``` ###⚠️ Model declined to note these PRs Selected for the notes but no bullet was generated, so they are **absent** from the dated section: #4383. Confirm each omission and re-cut if one should be noted. ###⚠️ Notes to double-check The generator flagged these notes low-confidence; confirm category and wording before merging: | PR | Category | Why flagged | |----|----------|-------------| | #3721 | Bug Fixes | intentional behavior/config change in a patch release; needs maintainer confirmation | | #4676 | Bug Fixes | could be Module API Changes instead of Bug Fixes | | #4823 | Bug Fixes | explicit impact scope omitted: 32-bit | ### Release-impact review Code detected release-impact terms (availability, memory safety, data integrity, access control, protocol, compatibility) in these PRs; this forces review, it is not a severity classification. The requested urgency is **SECURITY**. Confirm it and decide whether any change needs a hand-authored **Security Fixes** entry:⚠️ [#3972](#3972) names **CVE-2026-21863**. A named CVE normally ships with `SECURITY` urgency and a hand-authored **Security Fixes** entry; this holds the cut at any other urgency. <details> <summary>18 PR(s) with impact signals</summary> | PR | Title | Signal | |----|-------|--------| | [#4211](#4211) | Prevent double-free of the module timer when the callback stops it | memory-safety risk | | [#3971](#3971) | Fix GEORADIUS STORE ACL bypass via duplicate options | security, access-control, or injection hardening | | [#4383](#4383) | Tests: Add subject alternative names to the TLS test certificates | security, access-control, or injection hardening | | [#3922](#3922) | Harden stream validation on RDB load against crafted metadata | server crash, assertion, or availability failure | | [#4212](#4212) | Fix/ready key blocked client uaf | memory-safety risk | | [#4360](#4360) | Fix use-after-free crash when cluster messages arrive after module unload | memory-safety risk | | [#4410](#4410) | Fix out-of-bounds access in cluster message receivers | memory-safety risk | | [#3984](#3984) | AOF loading must not check ACL permissions | data or persisted-state corruption risk | | [#3721](#3721) | Force listpack validation on load to prevent deferred assertions | security, access-control, or injection hardening | | [#4307](#4307) | Fix VLA stack overflow in TLS writev after write failure | server crash, assertion, or availability failure | | [#3972](#3972) | Validate PUBLISH and MODULE payload lengths against packet size | server crash, assertion, or availability failure | | [#4395](#4395) | Fix mem_clients_type_memory leak for cached primary client | server crash, assertion, or availability failure | | [#4676](#4676) | Fix return types of three module API declarations to match definitions | security, access-control, or injection hardening | | [#3598](#3598) | fix: validate key count before allocating result in keyspec | undefined behavior or unsafe arithmetic | | [#4214](#4214) | fix(acl): prevent NULL pointer dereference on malformed selector in ACL file | server crash, assertion, or availability failure | | [#4733](#4733) | Fix sds overflow assert on RESTORE payload with an overflowing string length | server crash, assertion, or availability failure | | [#4489](#4489) | Hold no descriptor on nodes.conf when rename() publishes it | server crash, assertion, or availability failure | | [#5030](#5030) | Fix cluster Pub/Sub length truncation | memory-safety risk | </details> ### Excluded from generated notes (listed under Security Fixes) #5030 was supplied as a `--security-fix`, so the generated bullet(s) in the normal categories were dropped to avoid double-listing. To keep the notes consistent, it appears only under **Security Fixes**, where each is reviewed as a factual security entry. ###⚠️ Release-safety guardrail overrode AI triage AI excluded these PRs (or gave no verdict) but their text names a release-impact signal, so code forced them into the notes; confirm each bullet, category, urgency, and security treatment: | PR | Title | Guardrail reason | |----|-------|------------------| | [#4383](#4383) | Tests: Add subject alternative names to the TLS test certificates |⚠️ release-safety guardrail (security, access-control, or injection hardening; AI exclusion) | ### Triage summary - 12 PR(s) triaged into the notes - 7 PR(s) triaged out - 2 PR(s) hard-excluded by `no-release-notes` Per-PR verdicts (with reasons) are in the run's `triage-verdicts` artifact. To include a wrongly-dropped PR, label it `release-notes` and re-cut. ###⚠️ Notes with an unconfirmed cherry-pick origin These notes carry a `-x` trailer whose source commit is unreachable, so the credited `(#N)` may not be the change's author; confirm the origin and correct the credit if needed: | Credited PR | Range commit | Subject | Source commit(s) | |-------------|--------------|---------|------------------| | #4307 | `34d2c613ab4f` | Fix VLA stack overflow in TLS writev after write failure (#4307) | `fdb304b570b3` | | #3972 | `e47ceb7acfd9` | Validate PUBLISH and MODULE payload lengths against packet size (#3972) | `b1b5adfce837` | ### Prior wording not reused Another release line already published a note for these PRs, but this cut kept its own wording, so the entries will not read identically: <details> <summary>2 note(s) not reusing published wording</summary> | PR | Other line | Why the wording was not reused | |----|------------|--------------------------------| | #4307 | `9.1` (Valkey 9.1.2) | this cut could not confirm the PR the note credits (unresolved backport, cherry-pick, or reused PR number), and that credit is the only thing joining the two notes | | #3972 | `9.1` (Valkey 9.1.2) | the PR names a CVE, so its wording is authored per release line by a human | </details> ### Wording carried from other release lines A backported change is cut once per release line, and each cut words its notes independently. To keep one commit from being described differently per branch, a note whose source PR another line already published takes that published wording verbatim (joined on the trailing `(#N)`, which always names the original source PR). Only the text is reused; the category, the `by @handle` credit, and the `(#N)` are this cut's own. - Release lines consulted: `9.2`, `9.1`, `9.0`, `8.1`, `8.0`, `7.0`, `6.2`, `6.0`, `5.0`, `4.0`, `3.2`, `3.0`, `2.8`, `2.6`, `2.4`, `2.2` - 1 generated note(s) already matches the published wording: #4211 - Reused published wording for 12 note(s) <details> <summary>12 note(s) reusing published wording</summary> | PR | Wording from | Carried wording | This cut generated | |----|--------------|-----------------|--------------------| | #4342 | `9.1` (Valkey 9.1.2) | Truncate a partially written MULTI block from the AOF on short read, preventing loss of newer writes after a later restart | Fix AOF truncation after a short read inside a MULTI block leaving a malformed file that could lose later writes on restart | | #3971 | `9.1` (Valkey 9.1.2) | Fix an ACL bypass where duplicate STORE/STOREDIST options let GEORADIUS write or delete keys outside the user's permitted patterns | Fix an ACL bypass where duplicate STORE/STOREDIST options in GEORADIUS commands allowed writing or deleting keys outside permitted patterns | | #4360 | `9.1` (Valkey 9.1.2) | Fix a use-after-free crash when a module's cluster message type is received after the module is unloaded | Fix a use-after-free crash when a cluster message arrives for a module that has been unloaded | | #4410 | `9.1` (Valkey 9.1.2) | Fix out-of-bounds access for cluster module message type 255, which is now a valid, dispatchable message type | Fix an out-of-bounds access when a module registers or a node receives a cluster message of type 255, which is now a valid type | | #3984 | `9.1` (Valkey 9.1.2) | AOF loading no longer performs ACL checks on replayed commands, preventing silent data loss when the default user is disabled | Fix silent data loss when loading an AOF with a restrictive ACL configuration, since replayed commands must not be subject to permission checks | | #3721 | `9.1` (Valkey 9.1.2) | Listpacks are now always validated on RDB load and RESTORE, preventing deferred assertion crashes; `sanitize-dump-payload` and its ACL flags become no-ops | Always deeply validate listpacks on RDB load and RESTORE to prevent deferred assertion crashes; the `sanitize-dump-payload` config and `sanitize-payload` ACL flags are deprecated and become no-ops | | #4395 | `9.1` (Valkey 9.1.2) | Fix a client memory accounting leak on replicas that inflated the `mem_clients_normal` INFO field after primary disconnections | Fix the `mem_clients_normal` INFO field growing too high on replicas because the cached primary client's memory was never subtracted | | #3459 | `9.2` (Valkey 9.2.0-rc1) | Fix stream commands that mutate consumer-group or PEL state (`XGROUP`, `XSETID`, `XREADGROUP`, `XACK`, `XCLAIM`, `XAUTOCLAIM`) not triggering `WATCH` and client-side tracking invalidation | Fix stream commands such as XGROUP, XSETID, XACK, XCLAIM, XAUTOCLAIM and XREADGROUP not triggering WATCH and client-side tracking invalidation | | #3922 | `9.1` (Valkey 9.1.2) | Harden stream validation on RDB load and RESTORE so crafted payloads can no longer crash the server on later commands | Fix server crashes from crafted RESTORE stream payloads declaring an inconsistent length or negative field counts | | #4212 | `9.1` (Valkey 9.1.2) | Fix a use-after-free crash when serving clients blocked on the same key if one client is freed during processing | Fix a use-after-free crash when serving clients blocked on a key if handling one client frees another client blocked on the same key | | #4676 | `9.2` (Valkey 9.2.0-rc1) | Correct `ValkeyModule_FreeModuleUser`, `ValkeyModule_ACLAddLogEntry` and `ValkeyModule_ACLAddLogEntryByUserName` declarations to return int as implemented, fixing undefined behavior on targets with strict call signature checks | Fix the declared return types of `ValkeyModule_FreeModuleUser` and the ACL log entry module APIs to match their implementations, avoiding undefined behavior on strict platforms | | #4381 | `9.1` (Valkey 9.1.2) | Reject stream payloads with mismatched live/deleted record counts, preventing XDEL from destroying unaccounted entries | Reject corrupt stream payloads on load whose declared live/deleted record counts mismatch the actual records, preventing `XDEL` from destroying unaccounted entries | </details> *Generated by valkey-ci-agent. Review before merging into the release line.* --------- Signed-off-by: valkeyrie-bot[bot] <3692572+valkeyrie-bot[bot]@users.noreply.github.com> Signed-off-by: Sarthak Aggarwal <[email protected]> Co-authored-by: valkeyrie-bot[bot] <3692572+valkeyrie-bot[bot]@users.noreply.github.com> Co-authored-by: Sarthak Aggarwal <[email protected]>
Problem
Two crafted-
RESTOREcrashes in stream loading. In both, the payload passes the existing structural validation but violates an invariant downstream code relies on. Any client withRESTOREaccess can remotely crash the server.1. Length vs. tombstones
A stream can claim a positive
lengthwhile every listpack entry is a tombstone (STREAM_ITEM_FLAG_DELETED). The length is loaded directly from the payload and only checked against the rax being non-empty.streamLastValidID()then finds no non-tombstone entry whiles->lengthis non-zero and aborts:Triggered by
XSETID/XADD/XREADGROUP. Confirmed: a 2-entry stream with both entries flaggedDELETEDandlength=1loads OK, thenXSETIDpanics.2. Negative field counts
A master entry (or a per-entry field count for non-
SAMEFIELDSentries) can declare a negative number of fields. The validator only checkedlpGetIntegerIfValid()'s success flag, not the sign. The negative count drives listpack traversal instreamIteratorGetID(), walking past the listpack and asserting (lpAssertValidEntry) onXRANGEand similar reads. Confirmed: crafted payload loads OK, thenXRANGEaborts atlistpack.c.Fix
streamValidateListpackIntegrity()already parses each listpack's master entry count (live entries). Sum it across listpacks via a new out-parameter and reject the payload if it does not match the loaded length. This reuses the assertion-safe parsing rather than iterating the stream withstreamIteratorGetID(), which can itself hit entry-level assertions on other malformed payloads (an earlier iterate-based version regressed three existing corrupt-dump tests).primary_fieldsand per-entryfieldscounts during validation.Testing
RESTORE-path integration tests intests/integration/corrupt-dump.tcl.integration/corrupt-dumpsuite: 75 passed, 0 failed (including the three stream consumer-group tests an earlier iterate-based approach broke).Note
Found via structure-aware fuzzing + code review of the RESTORE path. This issue was generated by AI but verified, with love, by a human.