mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
fileio: clamp value of windowLog in patch-mode (#2637)
With small enough input files, the inferred value of fileWindowLog could be smaller than ZSTD_WINDOWLOG_MIN. This can be reproduced like so: $ echo abc > small $ echo abcdef > small2 $ zstd --patch-from small small2 -o patch previously, this would fail with the error "zstd: error 11 : Parameter is out of bound"
This commit is contained in:
@ -951,7 +951,7 @@ static void FIO_adjustParamsForPatchFromMode(FIO_prefs_t* const prefs,
|
||||
FIO_adjustMemLimitForPatchFromMode(prefs, dictSize, maxSrcFileSize);
|
||||
if (fileWindowLog > ZSTD_WINDOWLOG_MAX)
|
||||
DISPLAYLEVEL(1, "Max window log exceeded by file (compression ratio will suffer)\n");
|
||||
comprParams->windowLog = MIN(ZSTD_WINDOWLOG_MAX, fileWindowLog);
|
||||
comprParams->windowLog = MAX(ZSTD_WINDOWLOG_MIN, MIN(ZSTD_WINDOWLOG_MAX, fileWindowLog));
|
||||
if (fileWindowLog > ZSTD_cycleLog(cParams.chainLog, cParams.strategy)) {
|
||||
if (!prefs->ldmFlag)
|
||||
DISPLAYLEVEL(1, "long mode automatically triggered\n");
|
||||
|
Reference in New Issue
Block a user