Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/valkey-check-rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,14 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
uint64_t num_slot_ranges;
if ((num_slot_ranges = rdbLoadLen(rdb, NULL)) == RDB_LENERR) goto eoferr;
for (uint64_t i = 0; i < num_slot_ranges; i++) {
if (rdbLoadLen(rdb, NULL) == RDB_LENERR) goto eoferr;
if (rdbLoadLen(rdb, NULL) == RDB_LENERR) goto eoferr;
uint64_t start_slot, end_slot;
if ((start_slot = rdbLoadLen(rdb, NULL)) == RDB_LENERR) goto eoferr;
if ((end_slot = rdbLoadLen(rdb, NULL)) == RDB_LENERR) goto eoferr;
if (start_slot >= CLUSTER_SLOTS || end_slot >= CLUSTER_SLOTS || start_slot > end_slot) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/integration/rdb-slot-import.tcl already crafts RDB_OPCODE_SLOT_IMPORT records and runs VALKEY_CHECK_RDB_BIN, but this PR adds no case that reaches this check. Extend that fixture with start_slot == CLUSTER_SLOTS, end_slot == CLUSTER_SLOTS, and start_slot > end_slot, asserting each reports Invalid slot import range and does not report RDB looks OK.

rdbCheckError("Invalid slot import range in RDB: start=%llu end=%llu",
(unsigned long long)start_slot, (unsigned long long)end_slot);
goto err;
}
}
continue; /* Read type again. */
} else if (type == RDB_OPCODE_AUX) {
Expand Down
Loading