diff --git a/compress/decompress.go b/compress/decompress.go index d21ec482c..80773b34c 100644 --- a/compress/decompress.go +++ b/compress/decompress.go @@ -195,6 +195,9 @@ func NewDecompressor(compressedFile string) (*Decompressor, error) { for i < dictSize { d, ns := binary.Uvarint(data[i:]) + if d > 2048 { + return nil, fmt.Errorf("dictionary is invalid: patternMaxDepth=%d", d) + } depths = append(depths, d) if d > patternMaxDepth { patternMaxDepth = d @@ -232,6 +235,9 @@ func NewDecompressor(compressedFile string) (*Decompressor, error) { i = 0 for i < dictSize { d, ns := binary.Uvarint(data[i:]) + if d > 2048 { + return nil, fmt.Errorf("dictionary is invalid: posMaxDepth=%d", d) + } posDepths = append(posDepths, d) if d > posMaxDepth { posMaxDepth = d @@ -241,6 +247,9 @@ func NewDecompressor(compressedFile string) (*Decompressor, error) { i += uint64(n) poss = append(poss, pos) } + if posMaxDepth > 31 { + fmt.Printf("alex: %d\n", posMaxDepth) + } if dictSize > 0 { var bitLen int