From: W. Felix Handte Date: Wed, 14 Aug 2019 15:35:53 +0000 (-0400) Subject: Only the CCtx Itself Needs to be Cleared during Static CCtx Init X-Git-Tag: v1.4.4~1^2~57^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58b69ab15c9088a7c8afbc01431f3e33add54ed5;p=thirdparty%2Fzstd.git Only the CCtx Itself Needs to be Cleared during Static CCtx Init --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 78a579450..a8bf0d927 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -281,7 +281,7 @@ ZSTD_CCtx* ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize) ZSTD_CCtx* const cctx = (ZSTD_CCtx*) workspace; if (workspaceSize <= sizeof(ZSTD_CCtx)) return NULL; /* minimum size */ if ((size_t)workspace & 7) return NULL; /* must be 8-aligned */ - memset(workspace, 0, workspaceSize); /* may be a bit generous, could memset be smaller ? */ /* TODO(felixh): investigate */ + memset(cctx, 0, sizeof(ZSTD_CCtx)); cctx->staticSize = workspaceSize; ZSTD_workspace_init(&cctx->workspace, (void*)(cctx+1), workspaceSize - sizeof(ZSTD_CCtx));