summaryrefslogtreecommitdiff
path: root/src/hyperloglog.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-07-31 10:36:23 +0200
committerantirez <antirez@gmail.com>2019-07-31 10:36:23 +0200
commitb2079cb508a1944841abf39715d8a2d522452467 (patch)
tree97c8c432a75753df63a1ed8392a99ab2823856da /src/hyperloglog.c
parentf42846e8c7127c8e84b6938a6bd73e2363b4a90c (diff)
downloadredis-b2079cb508a1944841abf39715d8a2d522452467.tar.gz
HyperLogLog: fix the fix of a corruption bug.
Diffstat (limited to 'src/hyperloglog.c')
-rw-r--r--src/hyperloglog.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index e0557f985..5d4afaa25 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -700,8 +700,7 @@ int hllSparseSet(robj *o, long index, uint8_t count) {
p += oplen;
first += span;
}
- if (span == 0) return -1; /* Invalid format. */
- if (span >= end) return -1; /* Invalid format. */
+ if (span == 0 || p >= end) return -1; /* Invalid format. */
next = HLL_SPARSE_IS_XZERO(p) ? p+2 : p+1;
if (next >= end) next = NULL;