From 5aec3f78623499a1cd411fadd1cad8639936bc08 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Wed, 6 Mar 2019 14:33:49 -0600 Subject: [PATCH] fix UBSan warnings of unsigned overflow --- memcopy.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.47.2