From: Sebastian Pop Date: Wed, 6 Mar 2019 20:20:04 +0000 (-0600) Subject: use chunkcopysafe and chunkmemsetsafe under INFFAST_CHUNKSIZE from inflate X-Git-Tag: 1.9.9-b1~505 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f898fa08e955ef319d8529a2cfa68ae5e046e562;p=thirdparty%2Fzlib-ng.git use chunkcopysafe and chunkmemsetsafe under INFFAST_CHUNKSIZE from inflate --- diff --git a/inflate.c b/inflate.c index 293081ab..6ba76274 100644 --- a/inflate.c +++ b/inflate.c @@ -1164,18 +1164,26 @@ int ZEXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int flush) { copy = state->length; if (copy > left) copy = left; +#if defined(INFFAST_CHUNKSIZE) + put = chunkcopysafe(put, from, copy, put + left); +#else if (copy >= sizeof(uint64_t)) put = chunk_memcpy(put, from, copy); else put = copy_bytes(put, from, copy); +#endif } else { /* copy from output */ copy = state->length; if (copy > left) copy = left; +#if defined(INFFAST_CHUNKSIZE) + put = chunkmemsetsafe(put, state->offset, copy, left); +#else if (copy >= sizeof(uint64_t)) put = chunk_memset(put, put - state->offset, state->offset, copy); else put = set_bytes(put, put - state->offset, state->offset, copy); +#endif } left -= copy; state->length -= copy;