mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
Compress: limit patternMaxDepth (#598)
* save * save * save * save * save * save
This commit is contained in:
parent
36778a2db3
commit
09dba54e27
@ -195,6 +195,9 @@ func NewDecompressor(compressedFile string) (*Decompressor, error) {
|
|||||||
|
|
||||||
for i < dictSize {
|
for i < dictSize {
|
||||||
d, ns := binary.Uvarint(data[i:])
|
d, ns := binary.Uvarint(data[i:])
|
||||||
|
if d > 2048 {
|
||||||
|
return nil, fmt.Errorf("dictionary is invalid: patternMaxDepth=%d", d)
|
||||||
|
}
|
||||||
depths = append(depths, d)
|
depths = append(depths, d)
|
||||||
if d > patternMaxDepth {
|
if d > patternMaxDepth {
|
||||||
patternMaxDepth = d
|
patternMaxDepth = d
|
||||||
@ -232,6 +235,9 @@ func NewDecompressor(compressedFile string) (*Decompressor, error) {
|
|||||||
i = 0
|
i = 0
|
||||||
for i < dictSize {
|
for i < dictSize {
|
||||||
d, ns := binary.Uvarint(data[i:])
|
d, ns := binary.Uvarint(data[i:])
|
||||||
|
if d > 2048 {
|
||||||
|
return nil, fmt.Errorf("dictionary is invalid: posMaxDepth=%d", d)
|
||||||
|
}
|
||||||
posDepths = append(posDepths, d)
|
posDepths = append(posDepths, d)
|
||||||
if d > posMaxDepth {
|
if d > posMaxDepth {
|
||||||
posMaxDepth = d
|
posMaxDepth = d
|
||||||
@ -241,6 +247,9 @@ func NewDecompressor(compressedFile string) (*Decompressor, error) {
|
|||||||
i += uint64(n)
|
i += uint64(n)
|
||||||
poss = append(poss, pos)
|
poss = append(poss, pos)
|
||||||
}
|
}
|
||||||
|
if posMaxDepth > 31 {
|
||||||
|
fmt.Printf("alex: %d\n", posMaxDepth)
|
||||||
|
}
|
||||||
|
|
||||||
if dictSize > 0 {
|
if dictSize > 0 {
|
||||||
var bitLen int
|
var bitLen int
|
||||||
|
Loading…
Reference in New Issue
Block a user