Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zstd: Revert "Disallow 0 sized compressed blocks" #527

Merged
merged 1 commit into from Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions zstd/blockdec.go
Expand Up @@ -167,9 +167,9 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
}
return ErrCompressedSizeTooBig
}
// Empty compressed blocks not valid in practice,
// see https://github.com/facebook/zstd/issues/3090
if cSize < 3 {
// Empty compressed blocks must at least be 2 bytes
// for Literals_Block_Type and one for Sequences_Section_Header.
if cSize < 2 {
return ErrBlockTooSmall
}
case blockTypeRaw:
Expand Down
4 changes: 2 additions & 2 deletions zstd/fuzz.go
@@ -1,5 +1,5 @@
//go:build gofuzz
// +build gofuzz
//go:build ignorecrc
// +build ignorecrc

// Copyright 2019+ Klaus Post. All rights reserved.
// License information can be found in the LICENSE file.
Expand Down
4 changes: 2 additions & 2 deletions zstd/fuzz_none.go
@@ -1,5 +1,5 @@
//go:build !gofuzz
// +build !gofuzz
//go:build !ignorecrc
// +build !ignorecrc

// Copyright 2019+ Klaus Post. All rights reserved.
// License information can be found in the LICENSE file.
Expand Down
Binary file modified zstd/testdata/bad.zip
Binary file not shown.
Binary file modified zstd/testdata/good.zip
Binary file not shown.