]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
When Attaching Dictionary, Size Working Tables Based on Input Size Only
authorW. Felix Handte <w@felixhandte.com>
Wed, 12 Sep 2018 19:29:53 +0000 (12:29 -0700)
committerW. Felix Handte <w@felixhandte.com>
Sat, 29 Sep 2018 00:12:54 +0000 (17:12 -0700)
lib/compress/zstd_compress.c

index da8bd1e1e6119678759aaff368553b9ef95be2b6..2bd672c154a9d96bd904c3de2caa5a78d8bd9e6a 100644 (file)
@@ -1344,8 +1344,9 @@ static size_t ZSTD_resetCCtx_byAttachingCDict(
         const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams;
         unsigned const windowLog = params.cParams.windowLog;
         assert(windowLog != 0);
-        /* Copy only compression parameters related to tables. */
-        params.cParams = *cdict_cParams;
+        /* Resize working context table params for input only, since the dict
+         * has its own tables. */
+        params.cParams = ZSTD_adjustCParams_internal(*cdict_cParams, pledgedSrcSize, 0);
         params.cParams.windowLog = windowLog;
         ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,
                                 ZSTDcrp_continue, zbuff);