Skip to content

Commit

Permalink
zstd: Fix fallback on incompressible block (#798)
Browse files Browse the repository at this point in the history
Regresssion from #792 (unreleased)
  • Loading branch information
klauspost committed Mar 28, 2023
1 parent 5753c12 commit 47eb6d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zstd/blockenc.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,8 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error {
// Maybe even add a bigger margin.
if len(b.output)-3-bhOffset >= b.size {
// Discard and encode as raw block.
b.encodeRaw(org)
b.output = b.encodeRawTo(b.output[:bhOffset], org)
b.popOffsets()
b.litEnc.Reuse = huff0.ReusePolicyNone
return nil
}
Expand Down
Binary file modified zstd/testdata/fuzz/encode-corpus-encoded.zip
Binary file not shown.

0 comments on commit 47eb6d4

Please sign in to comment.