]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Document change in CLI for --no-check during decompression in --help menu
authorsenhuang42 <senhuang96@fb.com>
Sat, 22 Aug 2020 20:58:41 +0000 (16:58 -0400)
committersenhuang42 <senhuang96@fb.com>
Mon, 24 Aug 2020 13:49:12 +0000 (09:49 -0400)
lib/decompress/zstd_decompress.c
lib/zstd.h
programs/zstdcli.c
tests/fuzzer.c

index 6999966a34fd7d4689d337092a9dd3285aa892e6..d0263810926ecf7ca2a2380588347844cd257f94 100644 (file)
@@ -1543,7 +1543,7 @@ static void ZSTD_DCtx_updateOversizedDuration(ZSTD_DStream* zds, size_t const ne
 {
     if (ZSTD_DCtx_isOverflow(zds, neededInBuffSize, neededOutBuffSize))
         zds->oversizedDuration++;
-    else
+    else 
         zds->oversizedDuration = 0;
 }
 
@@ -1750,7 +1750,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
 
                 {   int const tooSmall = (zds->inBuffSize < neededInBuffSize) || (zds->outBuffSize < neededOutBuffSize);
                     int const tooLarge = ZSTD_DCtx_isOversizedTooLong(zds);
-
+                    
                     if (tooSmall || tooLarge) {
                         size_t const bufferSize = neededInBuffSize + neededOutBuffSize;
                         DEBUGLOG(4, "inBuff  : from %u to %u",
index 9f9f991f3c68be539335d7dcb4becd4447b5fefa..572f5063bcb31bc7622214024156a4de4f765c04 100644 (file)
@@ -1701,8 +1701,8 @@ ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowS
  * Experimental parameter.
  * Default is 0 == disabled. Set to 1 to enable
  *
- * Tells the decompressor to skip checksum validation during decompression, regardless.
- * of whether or not checksumming was specified during decompression. This offers some
+ * Tells the decompressor to skip checksum validation during decompression, regardless
+ * of whether checksumming was specified during compression. This offers some
  * slight performance benefits, and may be useful for debugging.
  */
 #define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
index 1aea63dca64799adca2db267c54dddea81664c50..b7e7d1fdad46d1a5d546a90b76136205fe413f42 100644 (file)
@@ -196,6 +196,7 @@ static void usage_advanced(const char* programName)
     DISPLAYOUT( " -l     : print information about zstd compressed files \n");
     DISPLAYOUT( "--test  : test compressed file integrity \n");
     DISPLAYOUT( " -M#    : Set a memory usage limit for decompression \n");
+    DISPLAYOUT( "--no-check : disable validation of checksums in compressed frame \n");
 # if ZSTD_SPARSE_DEFAULT
     DISPLAYOUT( "--[no-]sparse : sparse mode (default: enabled on file, disabled on stdout) \n");
 # else
index 4f0676ab7aefc8f69e56a536e93b228876db7292..7f8d9f654a48148be51a73cc095802f223f29da7 100644 (file)
@@ -554,8 +554,10 @@ static int basicUnitTests(U32 const seed, double compressibility)
         ZSTD_freeCCtx(cctx);
     }
     {   /* copy the compressed buffer and corrupt the checksum */
-        char* corruptedChecksumCompressedBuffer = (char*)malloc(cSize);
-        if (!corruptedChecksumCompressedBuffer) {
+        size_t r;
+        char* const corruptedChecksumCompressedBuffer = (char*)malloc(cSize);
+        ZSTD_DCtx* const dctx = ZSTD_createDCtx();
+        if (!corruptedChecksumCompressedBuffer || !dctx) {
             DISPLAY("Not enough memory, aborting\n");
             testResult = 1;
             goto _end;
@@ -563,11 +565,10 @@ static int basicUnitTests(U32 const seed, double compressibility)
 
         memcpy(corruptedChecksumCompressedBuffer, compressedBuffer, cSize);
         corruptedChecksumCompressedBuffer[cSize-1] += 1;
-        size_t r = ZSTD_decompress(decodedBuffer, CNBuffSize, corruptedChecksumCompressedBuffer, cSize);
+        r = ZSTD_decompress(decodedBuffer, CNBuffSize, corruptedChecksumCompressedBuffer, cSize);
         if (!ZSTD_isError(r)) goto _output_error;
         if (ZSTD_getErrorCode(r) != ZSTD_error_checksum_wrong) goto _output_error;
 
-        ZSTD_DCtx* dctx = ZSTD_createDCtx(); assert(dctx != NULL);
         CHECK_Z(ZSTD_DCtx_setForceIgnoreChecksum(dctx, ZSTD_d_ignoreChecksum));
         r = ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, corruptedChecksumCompressedBuffer, cSize);
         if (ZSTD_isError(r)) goto _output_error;