]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
fix UBSan warnings of unsigned overflow
authorSebastian Pop <s.pop@samsung.com>
Wed, 6 Mar 2019 20:33:49 +0000 (14:33 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 21 Mar 2019 10:22:36 +0000 (11:22 +0100)
memcopy.h

index fdccba5e1db87522ec8206cde50347b86508fb5b..e0e82c7acca3da09eb4edede0d23bf18a444cf78 100644 (file)
--- a/memcopy.h
+++ b/memcopy.h
@@ -65,10 +65,11 @@ static inline unsigned char* chunkcopy(unsigned char *out, unsigned char const *
     out += (len % INFFAST_CHUNKSIZE) + 1;
     from += (len % INFFAST_CHUNKSIZE) + 1;
     len /= INFFAST_CHUNKSIZE;
-    while (len-- > 0) {
+    while (len > 0) {
         storechunk(out, loadchunk(from));
         out += INFFAST_CHUNKSIZE;
         from += INFFAST_CHUNKSIZE;
+        --len;
     }
     return out;
 }