Skip to content

Commit 1d85079

Browse files
committed
run serialization should not be used if there is no run
1 parent 9774127 commit 1d85079

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

roaringarray.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,17 @@ func (ra *roaringArray) readFrom(stream internal.ByteInput, cookieHeader ...byte
596596
if err != nil {
597597
return stream.GetReadBytes(), fmt.Errorf("malformed bitmap, failed to read is-run bitmap, got: %s", err)
598598
}
599+
isAllZero := true
600+
for i := 0; i < isRunBitmapSize; i++ {
601+
if isRunBitmap[i] != 0 {
602+
isAllZero = false
603+
break
604+
}
605+
}
606+
if isAllZero {
607+
return stream.GetReadBytes(), fmt.Errorf("malformed bitmap, is-run bitmap cannot be all zero")
608+
}
609+
599610
} else if cookie == serialCookieNoRunContainer {
600611
size, err = stream.ReadUInt32()
601612
if err != nil {

0 commit comments

Comments
 (0)