From: Adam Stylinski Date: Fri, 18 Mar 2022 00:22:56 +0000 (-0400) Subject: Fix a latent issue with chunkmemset X-Git-Tag: 2.1.0-beta1~326 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e81c083fda107ca37b93304a1fd0aa9e68acfdee;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 189b5ec4..9ea37225 100644 --- a/chunkset_tpl.h +++ b/chunkset_tpl.h @@ -171,5 +171,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; }