]> granicus.if.org Git - vim/commitdiff
patch 8.2.5075: clang gives an out of bounds warning v8.2.5075
authorBram Moolenaar <Bram@vim.org>
Fri, 10 Jun 2022 13:52:35 +0000 (14:52 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 10 Jun 2022 13:52:35 +0000 (14:52 +0100)
Problem:    Clang gives an out of bounds warning.
Solution:   adjust conditional expression (John Marriott)

src/ui.c
src/version.c

index 08664bff65e2c2d49b6bc79817092212bf037d0c..8368c30540ec06004e16130e6912815e1c621134 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -897,7 +897,8 @@ read_from_input_buf(char_u *buf, long maxlen)
        maxlen = inbufcount;
     mch_memmove(buf, inbuf, (size_t)maxlen);
     inbufcount -= maxlen;
-    if (inbufcount)
+    // check "maxlen" to avoid clang warning
+    if (inbufcount > 0 && maxlen > 0)
        mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount);
     return (int)maxlen;
 }
index a2a2d756cdf842f25fc942fab65eadeb5117e47b..d86a23d5647385e5d192318a1ac46848c67e4fe3 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5075,
 /**/
     5074,
 /**/