diff --git a/zstd/blockdec.go b/zstd/blockdec.go index 50abf56569..7d567a54a0 100644 --- a/zstd/blockdec.go +++ b/zstd/blockdec.go @@ -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: diff --git a/zstd/fuzz.go b/zstd/fuzz.go index fda8a74228..7f2210e053 100644 --- a/zstd/fuzz.go +++ b/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. diff --git a/zstd/fuzz_none.go b/zstd/fuzz_none.go index 0515b201cc..6811c68a89 100644 --- a/zstd/fuzz_none.go +++ b/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. diff --git a/zstd/testdata/bad.zip b/zstd/testdata/bad.zip index 15be3cd510..28f0612867 100644 Binary files a/zstd/testdata/bad.zip and b/zstd/testdata/bad.zip differ diff --git a/zstd/testdata/good.zip b/zstd/testdata/good.zip index f6c230bc5d..e38a0f275c 100644 Binary files a/zstd/testdata/good.zip and b/zstd/testdata/good.zip differ