]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
use chunkcopysafe and chunkmemsetsafe under INFFAST_CHUNKSIZE from inflate
authorSebastian Pop <s.pop@samsung.com>
Wed, 6 Mar 2019 20:20:04 +0000 (14:20 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 21 Mar 2019 10:22:36 +0000 (11:22 +0100)
inflate.c

index 293081ab4d04888bb0860b895b22dc9ec788d9ce..6ba76274bdb5f3f5657069855161af527bf4aa78 100644 (file)
--- 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;