fixed --test on zero-length files, reported by @amnilsson
This commit is contained in:
parent
9cebec21e1
commit
7adc2328a3
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user