]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added protection : MT incompatible with Static allocation
authorYann Collet <cyan@fb.com>
Fri, 16 Jun 2017 01:03:34 +0000 (18:03 -0700)
committerYann Collet <cyan@fb.com>
Fri, 16 Jun 2017 01:03:34 +0000 (18:03 -0700)
lib/compress/zstd_compress.c
lib/zstd.h

index db672da0451d66cfb34cd9ffb2c7fe31d6e5ea15..8377b37e553593bdca5e375ead17f01af1124399 100644 (file)
@@ -339,6 +339,8 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned v
         if (value > 1) return ERROR(compressionParameter_unsupported);
 #endif
         if ((value>1) && (cctx->nbThreads != value)) {
+            if (cctx->staticSize)  /* MT not compatible with static alloc */
+                return ERROR(compressionParameter_unsupported);
             ZSTDMT_freeCCtx(cctx->mtctx);
             cctx->nbThreads = value;
             cctx->mtctx = ZSTDMT_createCCtx(value);
index 357af9194ee8705e947877e93015aad65274eb3a..eb72fc4e529064d048548c1ffcc99425ca620621 100644 (file)
@@ -68,7 +68,7 @@ ZSTDLIB_API unsigned ZSTD_versionNumber(void);   /**< to be used when checking d
 #define ZSTD_QUOTE(str) #str
 #define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str)
 #define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
-ZSTDLIB_API const char* ZSTD_versionString(void);
+ZSTDLIB_API const char* ZSTD_versionString(void);   /* v1.3.0 */
 
 
 /***************************************
@@ -424,6 +424,7 @@ typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; v
 /* use this constant to defer to stdlib's functions */
 static const ZSTD_customMem ZSTD_defaultCMem = { NULL, NULL, NULL};
 
+
 /***************************************
 *  Frame size functions
 ***************************************/