Repository navigation
[8.8-rse] [MOD-15685] Fix crash when a legacy index spec is restored on a running server - #11611
Merged
redisearch-backport-pull-request[bot] merged 1 commit intoSep 29, 2026
Conversation
…ng server (#10872) [MOD-15685] Refuse a legacy index spec RESTORE outside an RDB load A legacy index spec can only be upgraded while a load is in progress: both the UPGRADE_INDEX rules and the registry of legacy specs are built for the duration of a load and released at the end of it. IndexSpec_LegacyRdbLoad then looks both up unconditionally, so restoring a legacy ft_index0 payload on a running server reached dictFetchValue on a NULL dict and segfaulted. Any client holding RESTORE could do it. Refuse when either global is absent. The caller sees a load failure, which for RESTORE surfaces as a command error rather than a dead server. The check sits before anything is read, so a crafted payload needs no valid body to be rejected. Verified by removing the guard again: the server dies with the test reporting connection refused, so the test fails when the bug is present rather than passing for the wrong reason. This is MOD-15685 finding #71; #29 was fixed in #10817. Co-authored-by: Claude Opus 5 <[email protected]> (cherry picked from commit 1d4c089)
1 of 4 tasks
dor-forer
approved these changes
Sep 29, 2026
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.8-rse #11611 +/- ##
==========================================
Coverage ? 81.23%
==========================================
Files ? 562
Lines ? 76550
Branches ? 30619
==========================================
Hits ? 62185
Misses ? 14077
Partials ? 288
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
@cla-assistant check |
redisearch-backport-pull-request
Bot
deleted the
backport-agent/pr-10872-to-8.8-rse
branch
September 29, 2026 13:58
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.



Backport of #10872 to
8.8-rse.Merge commit:
1d4c08915f3cc628098679fc2286a47483d77599Describe the changes in the pull request
Closes the second half of MOD-15685. Finding #29 (legacy keys could not be persisted) was fixed in
#10817; this is finding #71, and with it the ticket can be closed.
1. Current — a legacy index spec can only be upgraded while an RDB load is in progress. Both the
UPGRADE_INDEXrules (legacySpecRules) and the registry of legacy specs (legacySpecDict) are builtfor the duration of a load and released at the end of it —
src/rules.candsrc/indexes.cset both toNULL. But
IndexSpec_LegacyRdbLoadlooks them up unconditionally:So a
RESTOREof a legacyft_index0payload on a running server reachesdictFetchValueon a NULLdict, which dereferences it in
dictSizeand segfaults. Reachable by any client holdingRESTORE.2. Change — refuse the load when either global is absent, before anything is read from the payload:
Returning NULL is how a module reports a failed load, which for
RESTOREsurfaces as a command error.Placing the check before any read means a crafted payload needs no valid body to be rejected.
3. Outcome — restoring a legacy index spec is a clean command error instead of a dead shard. The
genuine upgrade path is untouched: during a real RDB load both globals exist, so the check passes.
Verification
The new test asserts
RESTOREis refused for encoding versions 2, 9 and 16 (the legacy spec range isLEGACY_INDEX_MIN_VERSION..LEGACY_INDEX_MAX_VERSION, 2..16) and that the server is still up. I thenremoved the guard again and re-ran it: the server dies and the test reports
Connection refused. So itfails when the bug is present rather than passing for the wrong reason.
Which additional issues this PR fixes
Main objects this PR modified
src/spec.c—IndexSpec_LegacyRdbLoadguardtests/pytests/test_legacy_module_types.py— RESTORE of a legacy spec is refusedMark if applicable
Release Notes