Unverified Commit e7ccdeeb authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix rank overflow in zslInsert with more than 2B entries. (#9249)

If there are more than 2B entries in a zset.
The calculated span will overflow.
parent ee4bdf10
...@@ -131,7 +131,7 @@ int zslRandomLevel(void) { ...@@ -131,7 +131,7 @@ int zslRandomLevel(void) {
* of the passed SDS string 'ele'. */ * of the passed SDS string 'ele'. */
zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele) { zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele) {
zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x; zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;
unsigned int rank[ZSKIPLIST_MAXLEVEL]; unsigned long rank[ZSKIPLIST_MAXLEVEL];
int i, level; int i, level;
serverAssert(!isnan(score)); serverAssert(!isnan(score));
......
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