changeset 29109:c1c795a61545 v8.2.5075

patch 8.2.5075: clang gives an out of bounds warning Commit: https://github.com/vim/vim/commit/b74e04649168aec579183dfef70b8784d2afe993 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 10 14:52:35 2022 +0100 patch 8.2.5075: clang gives an out of bounds warning Problem: Clang gives an out of bounds warning. Solution: adjust conditional expression (John Marriott)
author Bram Moolenaar <Bram@vim.org>
date Fri, 10 Jun 2022 16:00:05 +0200
parents e5b1a1fd25b6
children 7aef804534ff
files src/ui.c src/version.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui.c
+++ b/src/ui.c
@@ -897,7 +897,8 @@ read_from_input_buf(char_u *buf, long ma
 	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;
 }
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    5075,
+/**/
     5074,
 /**/
     5073,