Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e216ceaf
Commit
e216ceaf
authored
Mar 15, 2019
by
antirez
Browse files
HyperLogLog: handle wrong offset in the base case.
parent
dca73582
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/hyperloglog.c
View file @
e216ceaf
...
...
@@ -614,10 +614,7 @@ int hllSparseToDense(robj *o) {
}
else
{
runlen
=
HLL_SPARSE_VAL_LEN
(
p
);
regval
=
HLL_SPARSE_VAL_VALUE
(
p
);
if
((
runlen
+
idx
)
>
HLL_REGISTERS
)
{
sdsfree
(
dense
);
return
C_ERR
;
}
if
((
runlen
+
idx
)
>
HLL_REGISTERS
)
break
;
/* Overflow. */
while
(
runlen
--
)
{
HLL_DENSE_SET_REGISTER
(
hdr
->
registers
,
idx
,
regval
);
idx
++
;
...
...
@@ -1097,8 +1094,7 @@ int hllMerge(uint8_t *max, robj *hll) {
}
else
{
runlen
=
HLL_SPARSE_VAL_LEN
(
p
);
regval
=
HLL_SPARSE_VAL_VALUE
(
p
);
if
((
runlen
+
i
)
>
HLL_REGISTERS
)
return
C_ERR
;
if
((
runlen
+
i
)
>
HLL_REGISTERS
)
break
;
/* Overflow. */
while
(
runlen
--
)
{
if
(
regval
>
max
[
i
])
max
[
i
]
=
regval
;
i
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment