mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Fix infinite loop in bitmap-to-array conversion.
When a run ended the container (i.e. contained column 65535), then the for loop would increment the 16-bit value to 0, at which point it was still <= 65535.
This commit is contained in:
parent
fec7413f96
commit
cf372cdd1d
2 changed files with 5 additions and 1 deletions
|
|
@ -1992,6 +1992,10 @@ func intersectBitmapRun(a, b *container) *container {
|
|||
if a.bitmapContains(i) {
|
||||
output.array = append(output.array, i)
|
||||
}
|
||||
// If the run ends the container, break to avoid an infinite loop.
|
||||
if i == 65535 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
output.n = len(output.array)
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ func TestIntersectBitmapRunArray(t *testing.T) {
|
|||
},
|
||||
{
|
||||
bitmap: []uint64{0xFFFFFFFFFFFFFFFF, 1, 1, 1, 0xA, 1, 1, 0, 1},
|
||||
runs: []interval16{{start: 63, last: 10000}},
|
||||
runs: []interval16{{start: 63, last: 10000}, {start: 65000, last: 65535}},
|
||||
exp: []uint16{63, 64, 128, 192, 257, 259, 320, 384, 512},
|
||||
expN: 9,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue