mirror of
https://github.com/facebook/zstd.git
synced 2025-10-04 00:02:33 -04:00
Merge pull request #4487 from neiljohari/adhoc/dictionary-file-counting
make DiB_fileStats skip invalid files (fileSize <= 0) to prevent negative totals and bogus allocation
This commit is contained in:
commit
e6e5a95c15
@ -280,8 +280,15 @@ static fileStats DiB_fileStats(const char** fileNamesTable, int nbFiles, size_t
|
||||
for (n=0; n<nbFiles; n++) {
|
||||
S64 const fileSize = DiB_getFileSize(fileNamesTable[n]);
|
||||
/* TODO: is there a minimum sample size? What if the file is 1-byte? */
|
||||
if (fileSize == 0) {
|
||||
DISPLAYLEVEL(3, "Sample file '%s' has zero size, skipping...\n", fileNamesTable[n]);
|
||||
/* Skip empty or invalid files */
|
||||
if (fileSize <= 0) {
|
||||
if (fileSize < 0) {
|
||||
DISPLAYLEVEL(3, "Sample file '%s' is unreadable or stat failed, skipping...\n",
|
||||
fileNamesTable[n]);
|
||||
} else {
|
||||
DISPLAYLEVEL(3, "Sample file '%s' has zero size, skipping...\n",
|
||||
fileNamesTable[n]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user