mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 03:47:51 +00:00
Test for no containers in pilosa roaring and fixed
This commit is contained in:
parent
ba05ef659b
commit
8445f6bdef
2 changed files with 7 additions and 3 deletions
|
|
@ -1095,7 +1095,7 @@ func (b *Bitmap) writeToUnoptimized(w io.Writer) (n int64, err error) {
|
|||
// unmarshalPilosaRoaring treats data as being encoded in Pilosa's 64 bit
|
||||
// roaring format and decodes it into b.
|
||||
func (b *Bitmap) unmarshalPilosaRoaring(data []byte) error {
|
||||
if len(data) < headerBaseSize {
|
||||
if len(data) <= headerBaseSize {
|
||||
return errors.New("data too small")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3312,14 +3312,18 @@ func TestUnmarshalRoaringWithErrors(t *testing.T) {
|
|||
hexString string
|
||||
expectedError string
|
||||
}{
|
||||
{ // Checks a bitmap without runs and no containers
|
||||
{ // Runs a bitmap without runs and no containers through the official roaring
|
||||
hexString : "3A30000000000000",
|
||||
expectedError : "reading roaring header: malformed bitmap, key-cardinality slice overruns buffer at 8",
|
||||
},
|
||||
{ // Checks a bitmap with runs and no containers
|
||||
{ // Runs a bitmap with runs and no containers through the official roaring
|
||||
hexString : "3B30000000000000",
|
||||
expectedError : "reading roaring header: malformed bitmap, key-cardinality slice overruns buffer at 9",
|
||||
},
|
||||
{ // Runs a bitmap in the Pilosa format through the Pilosa roaring
|
||||
hexString : "3C30000000000000",
|
||||
expectedError : "unmarshaling as pilosa roaring: data too small",
|
||||
},
|
||||
}
|
||||
for _, loopContainers := range noContainers {
|
||||
zeroContainers, _ := hex.DecodeString(loopContainers.hexString)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue