]> git.ipfire.org Git - thirdparty/zstd.git/commit
Fix ZSTD_estimateCCtxSize() Under ASAN 2129/head
authorW. Felix Handte <w@felixhandte.com>
Mon, 11 May 2020 22:53:32 +0000 (18:53 -0400)
committerW. Felix Handte <w@felixhandte.com>
Mon, 11 May 2020 22:58:19 +0000 (18:58 -0400)
commitc6636afbbb0d545347b17565b007195efaa3764e
treeac5f13ffc0d50a1f0fda6171021e35e17e9082a1
parent738f49178b6cf3b555195a1317503365f64ab549
Fix ZSTD_estimateCCtxSize() Under ASAN

`ZSTD_estimateCCtxSize()` provides estimates for one-shot compression, which
is guaranteed not to buffer inputs or outputs. So it ignores the sizes of the
buffers, assuming they'll be zero. However, the actual workspace allocation
logic always allocates those buffers, and when running under ASAN, the
workspace surrounds every allocation with 256 bytes of redzone. So the 0-sized
buffers end up consuming 512 bytes of space, which is accounted for in the
actual allocation path through the use of `ZSTD_cwksp_alloc_size()` but isn't
in the estimation path, since it ignores the buffers entirely.

This commit fixes this.
lib/compress/zstd_compress.c