From: Adam Stylinski Date: Fri, 18 Mar 2022 00:22:56 +0000 (-0400) Subject: Fix a latent issue with chunkmemset X-Git-Tag: 2.0.7~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46ebafe73f2aff8da6cc28a04922dbba5935017f;p=thirdparty%2Fzlib-ng.git Fix a latent issue with chunkmemset It would seem that on some platforms, namely those which are !UNALIGNED64_OK, there was a likelihood of chunkmemset_safe_c copying all the bytes before passing control flow to chunkcopy, a function which is explicitly unsafe to be called with a zero length copy. This fixes that bug for those platforms. --- diff --git a/chunkset_tpl.h b/chunkset_tpl.h index be52ee9f..68728d4a 100644 --- a/chunkset_tpl.h +++ b/chunkset_tpl.h @@ -200,5 +200,8 @@ Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, } return out; } - return CHUNKMEMSET(out, dist, len); + if (len) + return CHUNKMEMSET(out, dist, len); + + return out; }