From: Yann Collet Date: Mon, 18 Sep 2017 21:47:34 +0000 (-0700) Subject: fix ZSTD_sizeof_CCtx() / ZSTD_sizeof_CStream() X-Git-Tag: fuzz-corpora2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d1ff3817b685f691c31f4ce88d7dc70b3260e1a;p=thirdparty%2Fzstd.git fix ZSTD_sizeof_CCtx() / ZSTD_sizeof_CStream() previous result was over-estimated by counting streaming buffers twice --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index f35a44e4c..b0e9195dd 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -134,13 +134,12 @@ static size_t ZSTD_sizeof_mtctx(const ZSTD_CCtx* cctx) size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx) { if (cctx==NULL) return 0; /* support sizeof on NULL */ - DEBUGLOG(5, "sizeof(*cctx) : %u", (U32)sizeof(*cctx)); - DEBUGLOG(5, "workSpaceSize : %u", (U32)cctx->workSpaceSize); - DEBUGLOG(5, "streaming buffers : %u", (U32)(cctx->outBuffSize + cctx->inBuffSize)); - DEBUGLOG(5, "inner MTCTX : %u", (U32)ZSTD_sizeof_mtctx(cctx)); + DEBUGLOG(3, "sizeof(*cctx) : %u", (U32)sizeof(*cctx)); + DEBUGLOG(3, "workSpaceSize (including streaming buffers): %u", (U32)cctx->workSpaceSize); + DEBUGLOG(3, "inner cdict : %u", (U32)ZSTD_sizeof_CDict(cctx->cdictLocal)); + DEBUGLOG(3, "inner MTCTX : %u", (U32)ZSTD_sizeof_mtctx(cctx)); return sizeof(*cctx) + cctx->workSpaceSize + ZSTD_sizeof_CDict(cctx->cdictLocal) - + cctx->outBuffSize + cctx->inBuffSize + ZSTD_sizeof_mtctx(cctx); }