Unverified Commit ef3a5f58 authored by debing.sun's avatar debing.sun Committed by GitHub
Browse files

Fix missing initialization of EbucketsIterator->isRax (#13545)

in https://github.com/redis/redis/pull/13519, when `eb` is empty,
`isRax` is not correctly initialized to 0, which can lead to `ebStop()`
potentially entering the wrong rax branch.
parent f2f85ba3
...@@ -1886,6 +1886,7 @@ uint64_t ebGetExpireTime(EbucketsType *type, eItem item) { ...@@ -1886,6 +1886,7 @@ uint64_t ebGetExpireTime(EbucketsType *type, eItem item) {
void ebStart(EbucketsIterator *iter, ebuckets eb, EbucketsType *type) { void ebStart(EbucketsIterator *iter, ebuckets eb, EbucketsType *type) {
iter->eb = eb; iter->eb = eb;
iter->type = type; iter->type = type;
iter->isRax = 0;
if (ebIsEmpty(eb)) { if (ebIsEmpty(eb)) {
iter->currItem = NULL; iter->currItem = NULL;
...@@ -1893,7 +1894,6 @@ void ebStart(EbucketsIterator *iter, ebuckets eb, EbucketsType *type) { ...@@ -1893,7 +1894,6 @@ void ebStart(EbucketsIterator *iter, ebuckets eb, EbucketsType *type) {
} else if (ebIsList(eb)) { } else if (ebIsList(eb)) {
iter->currItem = ebGetListPtr(type, eb); iter->currItem = ebGetListPtr(type, eb);
iter->itemsCurrBucket = type->getExpireMeta(iter->currItem)->numItems; iter->itemsCurrBucket = type->getExpireMeta(iter->currItem)->numItems;
iter->isRax = 0;
} else { } else {
rax *rax = ebGetRaxPtr(eb); rax *rax = ebGetRaxPtr(eb);
raxStart(&iter->raxIter, rax); raxStart(&iter->raxIter, rax);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment