Unverified Commit 9ca5e8c5 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

fix zslGetRank bug in dead-code (#9246)



This fixes an issue with zslGetRank which will happen only if the
skiplist data stracture is added two entries with the same element name,
this can't happen in redis zsets (we use dict), but in theory this is a
bug in the underlaying skiplist code.

Fixes #3081 and #4032
Co-authored-by: default avatarminjian.cai <cmjgithub@163.com>
parent 71d45287
......@@ -488,7 +488,7 @@ unsigned long zslGetRank(zskiplist *zsl, double score, sds ele) {
}
/* x might be equal to zsl->header, so test if obj is non-NULL */
if (x->ele && sdscmp(x->ele,ele) == 0) {
if (x->ele && x->score == score && sdscmp(x->ele,ele) == 0) {
return rank;
}
}
......
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