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.
This commit is contained in:
Binbin 2021-07-18 21:47:33 +08:00 committed by GitHub
parent ee4bdf10ee
commit e7ccdeebc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -131,7 +131,7 @@ int zslRandomLevel(void) {
* of the passed SDS string 'ele'. */
zskiplistNode *zslInsert(zskiplist *zsl, double score, sds ele) {
zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;
unsigned int rank[ZSKIPLIST_MAXLEVEL];
unsigned long rank[ZSKIPLIST_MAXLEVEL];
int i, level;
serverAssert(!isnan(score));