summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-07-31 10:36:23 +0200
committerantirez <antirez@gmail.com>2019-07-31 10:37:01 +0200
commitff6db5f176caa426135bf9e603a1eb6f6dea4f83 (patch)
tree03bde86eed09878041f038a9584d4d118d0c53d2
parentdce11e658c9c3a29cab5ba87d72fa0a2c4ff13db (diff)
downloadredis-4.0.tar.gz
HyperLogLog: fix the fix of a corruption bug.4.0
-rw-r--r--src/hyperloglog.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index 6b18d1417..74d5b19b9 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -697,8 +697,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;