]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
improved efficiency for large messages with small dictionaries
authorYann Collet <yann.collet.73@gmail.com>
Fri, 15 Jul 2016 09:27:09 +0000 (11:27 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Fri, 15 Jul 2016 09:27:09 +0000 (11:27 +0200)
NEWS
lib/compress/zstd_compress.c
programs/fuzzer.c

diff --git a/NEWS b/NEWS
index cecc8f4985f321184676fef7c00200c758468f48..8c2808e0efb89cd41c2a078c64d5a41e32788dbc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 v0.7.4
 Added : new examples
-Fixed : segfault when using small dictionaries
+Fixed : segfault when using small dictionaries, reported by Felix Handte
 Modified : default compression level for CLI is 3
 
 
index ae182a973e43ff502d846cdfbb53fca4665b5d1f..98239b5d1479433e97f4036125a41a47d9212acc 100644 (file)
@@ -2695,7 +2695,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* zc,
                              const void* dict, size_t dictSize,
                                    ZSTD_parameters params, U64 pledgedSrcSize)
 {
-    size_t const resetError = ZSTD_resetCCtx_advanced(zc, params, pledgedSrcSize, 1, 0);
+    size_t const resetError = ZSTD_resetCCtx_advanced(zc, params, pledgedSrcSize, 1, (pledgedSrcSize==0) );
     if (ZSTD_isError(resetError)) return resetError;
 
     return ZSTD_compress_insertDictionary(zc, dict, dictSize);
index e56d6e1d612abe86cd235a513dde9814b409b004..b95e930d0449552fc290c737300c340b0cae91af 100644 (file)
@@ -209,7 +209,7 @@ static int basicUnitTests(U32 seed, double compressibility)
                       cSize += r);
             CHECKPLUS(r, ZSTD_compressEnd(ctxDuplicated, (char*)compressedBuffer+cSize, ZSTD_compressBound(CNBuffSize)-cSize),
                       cSize += r);
-            if (cSize != cSizeOrig) goto _output_error;   /* should be identical ==> have same size */
+            if (cSize != cSizeOrig) goto _output_error;   /* should be identical ==> same size */
         }
         DISPLAYLEVEL(4, "OK (%u bytes : %.2f%%)\n", (U32)cSize, (double)cSize/CNBuffSize*100);