diff --git a/lib/legacy/zstd_v07.c b/lib/legacy/zstd_v07.c index 62213997..d95fd438 100644 --- a/lib/legacy/zstd_v07.c +++ b/lib/legacy/zstd_v07.c @@ -4060,7 +4060,7 @@ static seq_t ZSTDv07_decodeSequence(seqState_t* seqState) } -FORCE_INLINE +static size_t ZSTDv07_execSequence(BYTE* op, BYTE* const oend, seq_t sequence, const BYTE** litPtr, const BYTE* const litLimit_w, diff --git a/programs/fileio.c b/programs/fileio.c index 3233be2e..f8542f78 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -696,7 +696,10 @@ static int FIO_decompressSrcFile(dRess_t ress, const char* srcFileName) /* check magic number -> version */ size_t const toRead = 4; size_t const sizeCheck = fread(ress.srcBuffer, (size_t)1, toRead, srcFile); - if (sizeCheck==0) break; /* no more input */ + if (sizeCheck==0) { + if (filesize==0) { DISPLAY("zstd: %s: unexpected end of file\n", srcFileName); return 1; } /* srcFileName is empty */ + break; /* no more input */ + } if (sizeCheck != toRead) EXM_THROW(31, "zstd: %s read error : cannot read header", srcFileName); { U32 const magic = MEM_readLE32(ress.srcBuffer); #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) diff --git a/programs/playTests.sh b/programs/playTests.sh index 75506081..ef44f7bd 100755 --- a/programs/playTests.sh +++ b/programs/playTests.sh @@ -209,6 +209,8 @@ $ZSTD -t * && die "bad files not detected !" $ZSTD -t tmp1 && die "bad file not detected !" cp tmp1 tmp2.zst $ZSTD -t tmp2.zst && die "bad file not detected !" +./datagen -g0 > tmp3 +$ZSTD -t tmp3 && die "bad file not detected !" # detects 0-sized files as bad $ECHO "test --rm and --test combined " $ZSTD -t --rm tmp1.zst ls -ls tmp1.zst # check file is still present