]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Make sure contentsize is known 1860/head
authorSen Huang <senhuang96@fb.com>
Wed, 30 Oct 2019 20:03:58 +0000 (16:03 -0400)
committerSen Huang <senhuang96@fb.com>
Wed, 30 Oct 2019 20:03:58 +0000 (16:03 -0400)
lib/compress/zstd_compress.c

index 07df9f04b29d0dc16d826f7585ce9177511841f1..a8856cd1b517330b8d5b163f4c6ac7d97efcb93f 100644 (file)
@@ -2934,6 +2934,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
       && (cdict->dictContentSize > 0)
       && ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF
         || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER
+        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
         || cdict->compressionLevel == 0)
       && (params->attachDictPref != ZSTD_dictForceLoad) ) {
         return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);
@@ -3381,6 +3382,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(
     {   ZSTD_CCtx_params params = cctx->requestedParams;
         params.cParams = ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF
                         || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER
+                        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
                         || cdict->compressionLevel == 0 )
                       && (params.attachDictPref != ZSTD_dictForceLoad) ?
                 ZSTD_getCParamsFromCDict(cdict)