]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fixed srcSize=1
authorYann Collet <yann.collet.73@gmail.com>
Tue, 13 Sep 2016 22:16:07 +0000 (00:16 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Tue, 13 Sep 2016 22:16:07 +0000 (00:16 +0200)
lib/compress/zstd_compress.c
lib/zstd.h
tests/fuzzer.c

index f832e081a0df1b475d5d2bc68ea598896c89f71c..1d59279e3ac13c954937800571e7126596caca54 100644 (file)
@@ -168,7 +168,7 @@ ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, u
     {   U32 const minSrcSize = (srcSize==0) ? 500 : 0;
         U64 const rSize = srcSize + dictSize + minSrcSize;
         if (rSize < ((U64)1<<ZSTD_WINDOWLOG_MAX)) {
-            U32 const srcLog = ZSTD_highbit32((U32)(rSize)-1) + 1;
+            U32 const srcLog = MAX(4, ZSTD_highbit32((U32)(rSize)-1) + 1);
             if (cPar.windowLog > srcLog) cPar.windowLog = srcLog;
     }   }
     if (cPar.hashLog > cPar.windowLog) cPar.hashLog = cPar.windowLog;
index a8b2de1248c73c9717ecd5ab80b44c9cb52451cf..6e3d43596c420fc05c4c7e47ecc9ddf6df1737cd 100644 (file)
@@ -50,7 +50,7 @@ ZSTDLIB_API unsigned ZSTD_versionNumber (void);
 /*! ZSTD_compress() :
     Compresses `src` content as a single zstd compressed frame into already allocated `dst`.
     Hint : compression runs faster if `dstCapacity` >=  `ZSTD_compressBound(srcSize)`.
-    @return : the number of bytes written into `dst` (<= `dstCapacity),
+    @return : compressed size written into `dst` (<= `dstCapacity),
               or an error code if it fails (which can be tested using ZSTD_isError()) */
 ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity,
                             const void* src, size_t srcSize,
index 323854b323a8b89f5c347d73f97089503bf1ae93..b8f102a9c78321109755acc8da5acff6ef3c3b06 100644 (file)
@@ -57,7 +57,7 @@ static U32 g_displayLevel = 2;
             if ((FUZ_clockSpan(g_displayClock) > g_refreshRate) || (g_displayLevel>=4)) \
             { g_displayClock = clock(); DISPLAY(__VA_ARGS__); \
             if (g_displayLevel>=4) fflush(stdout); } }
-static const clock_t g_refreshRate = CLOCKS_PER_SEC * 150 / 1000;
+static const clock_t g_refreshRate = CLOCKS_PER_SEC / 6;
 static clock_t g_displayClock = 0;