From 57a0db94956441ac14a252cd09daa45e3f3a9453 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 1 Sep 2016 11:08:44 +0200 Subject: [PATCH] Fix rdb.c var types when calling rdbLoadLen(). Technically as soon as Redis 64 bit gets proper support for loading collections and/or DBs with more than 2^32 elements, the 32 bit version should be modified in order to check if what we read from rdbLoadLen() overflows. This would only apply to huge RDB files created with a 64 bit instance and later loaded into a 32 bit instance. --- src/rdb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rdb.c b/src/rdb.c index 85929794..58cde1f2 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -1052,7 +1052,7 @@ void rdbRemoveTempFile(pid_t childpid) { * On success a newly allocated object is returned, otherwise NULL. */ robj *rdbLoadObject(int rdbtype, rio *rdb) { robj *o = NULL, *ele, *dec; - size_t len; + uint64_t len; unsigned int i; if (rdbtype == RDB_TYPE_STRING) { @@ -1119,7 +1119,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { } } else if (rdbtype == RDB_TYPE_ZSET_2 || rdbtype == RDB_TYPE_ZSET) { /* Read list/set value. */ - size_t zsetlen; + uint64_t zsetlen; size_t maxelelen = 0; zset *zs; @@ -1154,7 +1154,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { maxelelen <= server.zset_max_ziplist_value) zsetConvert(o,OBJ_ENCODING_ZIPLIST); } else if (rdbtype == RDB_TYPE_HASH) { - size_t len; + uint64_t len; int ret; sds field, value;