diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 43cfedc9c..62a407bb3 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -2333,8 +2333,8 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, if (frame && /* We don't want to emit our first block as a RLE even if it qualifies because - * doing so will cause the decoder to throw a "should consume all input error." - * https://github.com/facebook/zstd/blob/dev/programs/fileio.c#L1723 + * doing so will cause the decoder (cli only) to throw a "should consume all input error." + * This is only an issue for zstd <= v1.4.3 */ !zc->isFirstBlock && cSize < rleMaxLength && diff --git a/programs/fileio.c b/programs/fileio.c index 20e2ee2a1..8a45563d4 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -1719,11 +1719,6 @@ static unsigned long long FIO_decompressZstdFrame( } if (readSizeHint == 0) break; /* end of frame */ - if (inBuff.size != inBuff.pos) { - DISPLAYLEVEL(1, "%s : Decoding error (37) : should consume entire input \n", - srcFileName); - return FIO_ERROR_FRAME_DECODING; - } /* Fill input buffer */ { size_t const toDecode = MIN(readSizeHint, ress->srcBufferSize); /* support large skippable frames */ diff --git a/tests/files/huffman-compressed-larger b/tests/golden-compression/huffman-compressed-larger similarity index 100% rename from tests/files/huffman-compressed-larger rename to tests/golden-compression/huffman-compressed-larger diff --git a/tests/golden-decompression/rle-first-block.zst b/tests/golden-decompression/rle-first-block.zst new file mode 100644 index 000000000..fd067edd7 Binary files /dev/null and b/tests/golden-decompression/rle-first-block.zst differ diff --git a/tests/playTests.sh b/tests/playTests.sh index 19fc514f6..5a47ceb5e 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -241,6 +241,11 @@ $ZSTD -f tmp && die "attempt to compress a non existing file" test -f tmp.zst # destination file should still be present rm tmp* +println "\n===> decompression only tests " +head -c 1048576 /dev/zero > tmp +$ZSTD -d -o tmp1 "$TESTDIR/golden-decompression/rle-first-block.zst" +$DIFF -s tmp1 tmp +rm tmp* println "test : compress multiple files" println hello > tmp1 @@ -638,8 +643,8 @@ $ZSTD -t tmpSplit.* && die "bad file not detected !" println "\n===> golden files tests " -$ZSTD -t -r "$TESTDIR/files" -$ZSTD -c -r "$TESTDIR/files" | $ZSTD -t +$ZSTD -t -r "$TESTDIR/golden-compression" +$ZSTD -c -r "$TESTDIR/golden-compression" | $ZSTD -t println "\n===> benchmark mode tests "