]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added error message to catch case where size not given
authorPaul Cruz <paulcruz74@fb.com>
Wed, 14 Jun 2017 19:04:22 +0000 (12:04 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Wed, 14 Jun 2017 19:04:22 +0000 (12:04 -0700)
tests/decodecorpus.c

index 5a897cc4e5cc170992ccfc1d98a3890b2e59e638..9bd6506e29f3754dd7d46c9a9de554fffcc50a11 100644 (file)
@@ -1326,12 +1326,15 @@ static int generateCorpusWithDict(U32 seed, unsigned numFiles, const char* const
         DISPLAY("Error: path too long\n");
         return 1;
     }
-
+    if(dictSize < 400){
+        DISPLAY("Error: either no size given or given dictionary size is too small\n");
+        return 1;
+    }
     /* Generate the dictionary randomly first */
     dictContent = malloc(dictSize-400);
     dictID = RAND(&seed);
     fullDict = malloc(dictSize);
-    RAND_buffer(&seed, dictContent, dictSize-40);
+    RAND_buffer(&seed, dictContent, dictSize-400);
     {
         size_t dictWriteSize = 0;