From 26065c3f47381c6ebe56ea114015b3c2b1c2a615 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 20 May 2015 08:58:59 +0100 Subject: Fixed : LZ4IO exits too early when frame crc not present, reported by Yongwoon Cho (#106) --- NEWS | 2 ++ programs/Makefile | 11 +++++++++-- programs/lz4io.c | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 6d872fe..8cb5129 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ r130: +Fixed : incompatibility sparse mode vs console, reported by Yongwoon Cho (#105) +Fixed : LZ4IO exits too early when frame crc not present, reported by Yongwoon Cho (#106) r129: Added : LZ4_compress_fast(), LZ4_compress_fast_continue() diff --git a/programs/Makefile b/programs/Makefile index 1798b8f..f015d27 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -168,8 +168,9 @@ test-lz4-sparse: lz4 datagen ls -ls tmpOdd @rm tmp* @echo "\n Compatibility with Console :" - ./lz4 COPYING | ./lz4 -d -c - ./lz4 COPYING | ./lz4 -d | cat + echo "Hello World 1 !" | ./lz4 | ./lz4 -d -c + echo "Hello World 2 !" | ./lz4 | ./lz4 -d | cat + echo "Hello World 3 !" | ./lz4 --no-frame-crc | ./lz4 -d -c test-lz4-contentSize: lz4 datagen @echo "\n ---- test original size support ----" @@ -214,6 +215,11 @@ test-lz4-basic: lz4 datagen @echo "\n ---- test lz4 basic compression/decompression ----" ./datagen -g0 | ./lz4 -v | ./lz4 -t ./datagen -g16KB | ./lz4 -9 | ./lz4 -t + ./datagen -g20KB > tmpSrc + ./lz4 < tmpSrc | ./lz4 -d > tmpRes + diff -q tmpSrc tmpRes + ./lz4 --no-frame-crc < tmpSrc | ./lz4 -d > tmpRes + diff -q tmpSrc tmpRes ./datagen | ./lz4 | ./lz4 -t ./datagen -g6M -P99 | ./lz4 -9BD | ./lz4 -t ./datagen -g17M | ./lz4 -9v | ./lz4 -qt @@ -221,6 +227,7 @@ test-lz4-basic: lz4 datagen ./datagen -g256MB | ./lz4 -vqB4D | ./lz4 -t ./datagen -g6GB | ./lz4 -vqB5D | ./lz4 -qt ./datagen -g6GB | ./lz4 -vq9BD | ./lz4 -qt + @rm tmp* test-lz4: lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-sparse test-lz4-contentSize test-lz4-frame-concatenation @echo "\n ---- test pass-through ----" diff --git a/programs/lz4io.c b/programs/lz4io.c index 8b80fbc..dc0b9ec 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -851,7 +851,6 @@ static unsigned long long LZ4IO_decompressLZ4F(dRess_t ress, FILE* srcFile, FILE nextToLoad = LZ4F_decompress(ress.dCtx, ress.dstBuffer, &decodedBytes, (char*)(ress.srcBuffer)+pos, &remaining, NULL); if (LZ4F_isError(nextToLoad)) EXM_THROW(66, "Decompression error : %s", LZ4F_getErrorName(nextToLoad)); pos += remaining; - if (!nextToLoad) break; if (decodedBytes) { @@ -860,6 +859,8 @@ static unsigned long long LZ4IO_decompressLZ4F(dRess_t ress, FILE* srcFile, FILE DISPLAYUPDATE(2, "\rDecompressed : %u MB ", (unsigned)(filesize>>20)); storedSkips = LZ4IO_fwriteSparse(dstFile, ress.dstBuffer, decodedBytes, storedSkips); } + + if (!nextToLoad) break; } } -- cgit v0.12