Skip to content

Commit

Permalink
zstd: Reject blocks where reserved values are not 0
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Nov 15, 2023
1 parent 80ba129 commit bce5e21
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 bce5e21

Please sign in to comment.