From e7ccdeebc9b3e3b663ac39a54d05483a7fdc7eb6 Mon Sep 17 00:00:00 2001 From: Binbin Date: Sun, 18 Jul 2021 21:47:33 +0800 Subject: [PATCH] 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. --- src/t_zset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t_zset.c b/src/t_zset.c index 28f1df05e..ce3b85f36 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -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));