Skip to content

Commit

Permalink
zstd: Reject blocks where reserved values are not 0 (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost authored Mar 6, 2024
1 parent 4f3f95b commit 165be36
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zstd/blockdec.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ func (b *blockDec) prepareSequences(in []byte, hist *history) (err error) {
if debugDecoder {
printf("Compression modes: 0b%b", compMode)
}
if compMode&3 != 0 {
return errors.New("corrupt block: reserved bits not zero")
}
for i := uint(0); i < 3; i++ {
mode := seqCompMode((compMode >> (6 - i*2)) & 3)
if debugDecoder {
Expand Down

0 comments on commit 165be36

Please sign in to comment.