mirror of
https://github.com/facebook/zstd.git
synced 2025-08-07 06:23:00 +03:00
Document change in CLI for --no-check during decompression in --help menu
This commit is contained in:
@@ -1543,7 +1543,7 @@ static void ZSTD_DCtx_updateOversizedDuration(ZSTD_DStream* zds, size_t const ne
|
|||||||
{
|
{
|
||||||
if (ZSTD_DCtx_isOverflow(zds, neededInBuffSize, neededOutBuffSize))
|
if (ZSTD_DCtx_isOverflow(zds, neededInBuffSize, neededOutBuffSize))
|
||||||
zds->oversizedDuration++;
|
zds->oversizedDuration++;
|
||||||
else
|
else
|
||||||
zds->oversizedDuration = 0;
|
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 tooSmall = (zds->inBuffSize < neededInBuffSize) || (zds->outBuffSize < neededOutBuffSize);
|
||||||
int const tooLarge = ZSTD_DCtx_isOversizedTooLong(zds);
|
int const tooLarge = ZSTD_DCtx_isOversizedTooLong(zds);
|
||||||
|
|
||||||
if (tooSmall || tooLarge) {
|
if (tooSmall || tooLarge) {
|
||||||
size_t const bufferSize = neededInBuffSize + neededOutBuffSize;
|
size_t const bufferSize = neededInBuffSize + neededOutBuffSize;
|
||||||
DEBUGLOG(4, "inBuff : from %u to %u",
|
DEBUGLOG(4, "inBuff : from %u to %u",
|
||||||
|
@@ -1701,8 +1701,8 @@ ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowS
|
|||||||
* Experimental parameter.
|
* Experimental parameter.
|
||||||
* Default is 0 == disabled. Set to 1 to enable
|
* Default is 0 == disabled. Set to 1 to enable
|
||||||
*
|
*
|
||||||
* Tells the decompressor to skip checksum validation during decompression, regardless.
|
* Tells the decompressor to skip checksum validation during decompression, regardless
|
||||||
* of whether or not checksumming was specified during decompression. This offers some
|
* of whether checksumming was specified during compression. This offers some
|
||||||
* slight performance benefits, and may be useful for debugging.
|
* slight performance benefits, and may be useful for debugging.
|
||||||
*/
|
*/
|
||||||
#define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
|
#define ZSTD_d_forceIgnoreChecksum ZSTD_d_experimentalParam3
|
||||||
|
@@ -196,6 +196,7 @@ static void usage_advanced(const char* programName)
|
|||||||
DISPLAYOUT( " -l : print information about zstd compressed files \n");
|
DISPLAYOUT( " -l : print information about zstd compressed files \n");
|
||||||
DISPLAYOUT( "--test : test compressed file integrity \n");
|
DISPLAYOUT( "--test : test compressed file integrity \n");
|
||||||
DISPLAYOUT( " -M# : Set a memory usage limit for decompression \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
|
# if ZSTD_SPARSE_DEFAULT
|
||||||
DISPLAYOUT( "--[no-]sparse : sparse mode (default: enabled on file, disabled on stdout) \n");
|
DISPLAYOUT( "--[no-]sparse : sparse mode (default: enabled on file, disabled on stdout) \n");
|
||||||
# else
|
# else
|
||||||
|
@@ -554,8 +554,10 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
}
|
}
|
||||||
{ /* copy the compressed buffer and corrupt the checksum */
|
{ /* copy the compressed buffer and corrupt the checksum */
|
||||||
char* corruptedChecksumCompressedBuffer = (char*)malloc(cSize);
|
size_t r;
|
||||||
if (!corruptedChecksumCompressedBuffer) {
|
char* const corruptedChecksumCompressedBuffer = (char*)malloc(cSize);
|
||||||
|
ZSTD_DCtx* const dctx = ZSTD_createDCtx();
|
||||||
|
if (!corruptedChecksumCompressedBuffer || !dctx) {
|
||||||
DISPLAY("Not enough memory, aborting\n");
|
DISPLAY("Not enough memory, aborting\n");
|
||||||
testResult = 1;
|
testResult = 1;
|
||||||
goto _end;
|
goto _end;
|
||||||
@@ -563,11 +565,10 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||||||
|
|
||||||
memcpy(corruptedChecksumCompressedBuffer, compressedBuffer, cSize);
|
memcpy(corruptedChecksumCompressedBuffer, compressedBuffer, cSize);
|
||||||
corruptedChecksumCompressedBuffer[cSize-1] += 1;
|
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_isError(r)) goto _output_error;
|
||||||
if (ZSTD_getErrorCode(r) != ZSTD_error_checksum_wrong) 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));
|
CHECK_Z(ZSTD_DCtx_setForceIgnoreChecksum(dctx, ZSTD_d_ignoreChecksum));
|
||||||
r = ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, corruptedChecksumCompressedBuffer, cSize);
|
r = ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, corruptedChecksumCompressedBuffer, cSize);
|
||||||
if (ZSTD_isError(r)) goto _output_error;
|
if (ZSTD_isError(r)) goto _output_error;
|
||||||
|
Reference in New Issue
Block a user