summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hyperloglog.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index e807e246f..de25cc991 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -688,8 +688,7 @@ int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) {
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;