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
7f79849c
Commit
7f79849c
authored
Mar 14, 2019
by
John Sully
Committed by
antirez
Mar 18, 2019
Browse files
Fix hyperloglog corruption
parent
3ef2c831
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/hyperloglog.c
View file @
7f79849c
...
@@ -614,6 +614,10 @@ int hllSparseToDense(robj *o) {
...
@@ -614,6 +614,10 @@ int hllSparseToDense(robj *o) {
}
else
{
}
else
{
runlen
=
HLL_SPARSE_VAL_LEN
(
p
);
runlen
=
HLL_SPARSE_VAL_LEN
(
p
);
regval
=
HLL_SPARSE_VAL_VALUE
(
p
);
regval
=
HLL_SPARSE_VAL_VALUE
(
p
);
if
((
runlen
+
idx
)
>
HLL_REGISTERS
)
{
sdsfree
(
dense
);
return
C_ERR
;
}
while
(
runlen
--
)
{
while
(
runlen
--
)
{
HLL_DENSE_SET_REGISTER
(
hdr
->
registers
,
idx
,
regval
);
HLL_DENSE_SET_REGISTER
(
hdr
->
registers
,
idx
,
regval
);
idx
++
;
idx
++
;
...
@@ -1088,6 +1092,8 @@ int hllMerge(uint8_t *max, robj *hll) {
...
@@ -1088,6 +1092,8 @@ int hllMerge(uint8_t *max, robj *hll) {
}
else
{
}
else
{
runlen
=
HLL_SPARSE_VAL_LEN
(
p
);
runlen
=
HLL_SPARSE_VAL_LEN
(
p
);
regval
=
HLL_SPARSE_VAL_VALUE
(
p
);
regval
=
HLL_SPARSE_VAL_VALUE
(
p
);
if
((
runlen
+
i
)
>
HLL_REGISTERS
)
return
C_ERR
;
while
(
runlen
--
)
{
while
(
runlen
--
)
{
if
(
regval
>
max
[
i
])
max
[
i
]
=
regval
;
if
(
regval
>
max
[
i
])
max
[
i
]
=
regval
;
i
++
;
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