stricter protection against bad dict in decompressor (#962)

This commit is contained in:
Alex Sharov 2023-03-31 10:16:03 +07:00 committed by GitHub
parent 9431fe1b94
commit 6cb595fe66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -187,7 +187,7 @@ func NewDecompressor(compressedFilePath string) (*Decompressor, error) {
for i < dictSize { for i < dictSize {
d, ns := binary.Uvarint(data[i:]) d, ns := binary.Uvarint(data[i:])
if d > 2048 { if d > 64 { // mainnet has maxDepth 31
return nil, fmt.Errorf("dictionary is invalid: patternMaxDepth=%d", d) return nil, fmt.Errorf("dictionary is invalid: patternMaxDepth=%d", d)
} }
depths = append(depths, d) depths = append(depths, d)