Skip to content

Commit 6125c11

Browse files
authored
zstd: Reject empty compressed blocks (#862)
* zstd: Reject empty compressed blocks * Update good inputs Matches zstandard behaviour.
1 parent 7b22298 commit 6125c11

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

zstd/blockdec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,9 @@ func (b *blockDec) decodeCompressed(hist *history) error {
489489
return err
490490
}
491491
if hist.decoders.nSeqs == 0 {
492+
if len(hist.decoders.literals) == 0 {
493+
return errors.New("invalid block: no literals nor sequences found")
494+
}
492495
b.dst = append(b.dst, hist.decoders.literals...)
493496
return nil
494497
}

zstd/testdata/good.zip

32.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)