]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix Integer Overflow 2424/head
authorihsinme <61293369+ihsinme@users.noreply.github.com>
Sun, 13 Dec 2020 09:08:31 +0000 (12:08 +0300)
committerGitHub <noreply@github.com>
Sun, 13 Dec 2020 09:08:31 +0000 (12:08 +0300)
programs/dibio.c

index 463095a8e813b00448d4a242796062eb2c12b47c..cb3829e3e59bb670d1ff20a8aee84a32e4a39250 100644 (file)
@@ -301,7 +301,7 @@ int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize,
         DISPLAYLEVEL(2, "!  Alternatively, split files into fixed-size blocks representative of samples, with -B# \n");
         EXM_THROW(14, "nb of samples too low");   /* we now clearly forbid this case */
     }
-    if (fs.totalSizeToLoad < (unsigned long long)(8 * maxDictSize)) {
+    if (fs.totalSizeToLoad < (unsigned long long)maxDictSize * 8) {
         DISPLAYLEVEL(2, "!  Warning : data size of samples too small for target dictionary size \n");
         DISPLAYLEVEL(2, "!  Samples should be about 100x larger than target dictionary size \n");
     }