diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-04 17:58:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-04 17:58:41 +0000 |
commit | 7aaff451bafb4b43e1626b329e59a4c9aa7fc31d (patch) | |
tree | ef3363c81916814c65c92fbbfa49f5cb2be77bba /src/t_zset.c | |
parent | Adding debian version 5:7.2.4-1. (diff) | |
download | redis-7aaff451bafb4b43e1626b329e59a4c9aa7fc31d.tar.xz redis-7aaff451bafb4b43e1626b329e59a4c9aa7fc31d.zip |
Merging upstream version 5:7.2.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/t_zset.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/t_zset.c b/src/t_zset.c index 7717a4a..1b267e0 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -1172,7 +1172,8 @@ unsigned long zsetLength(const robj *zobj) { * and the value len hint indicates the approximate individual size of the added elements, * they are used to determine the initial representation. * - * If the hints are not known, and underestimation or 0 is suitable. */ + * If the hints are not known, and underestimation or 0 is suitable. + * We should never pass a negative value because it will convert to a very large unsigned number. */ robj *zsetTypeCreate(size_t size_hint, size_t val_len_hint) { if (size_hint <= server.zset_max_listpack_entries && val_len_hint <= server.zset_max_listpack_value) @@ -3001,7 +3002,7 @@ static void zrangeResultFinalizeClient(zrange_result_handler *handler, /* Result handler methods for storing the ZRANGESTORE to a zset. */ static void zrangeResultBeginStore(zrange_result_handler *handler, long length) { - handler->dstobj = zsetTypeCreate(length, 0); + handler->dstobj = zsetTypeCreate(length >= 0 ? length : 0, 0); } static void zrangeResultEmitCBufferForStore(zrange_result_handler *handler, |