mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 00:52:38 +00:00
Fix hyperloglog corruption
This commit is contained in:
parent
e10c79d3ff
commit
cc2b3a68e6
@ -611,6 +611,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++;
|
||||||
@ -1081,6 +1085,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++;
|
||||||
|
Loading…
Reference in New Issue
Block a user