From: Sebastian Pop Date: Wed, 6 Mar 2019 20:33:49 +0000 (-0600) Subject: fix UBSan warnings of unsigned overflow X-Git-Tag: 1.9.9-b1~503 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5aec3f78623499a1cd411fadd1cad8639936bc08;p=thirdparty%2Fzlib-ng.git fix UBSan warnings of unsigned overflow --- diff --git a/memcopy.h b/memcopy.h index fdccba5e..e0e82c7a 100644 --- 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; }