]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0022: Coverity complains about improper use of negative value v9.1.0022
authorChristian Brabandt <cb@256bit.org>
Fri, 12 Jan 2024 16:48:08 +0000 (17:48 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 12 Jan 2024 16:48:08 +0000 (17:48 +0100)
Problem:  Coverity complains about improper use of negative value
Solution: Add a condition to validate that keytyped is larger or equal
          to 0

Apparently patch 9.1.0006 made it more explicit for Coverity, that the
TOLOWER_LOC() macros do not handle negative values properly. However,
that condition has always been there even before that, so add a
condition to verify that keytyped is indeed at least 0

closes: #13824

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/cindent.c
src/version.c

index 62894228b16d4c65dceb5e6c959dc1bd99779904..cf18441f608421f8d25d14c2815595cee70207e4 100644 (file)
@@ -4108,7 +4108,8 @@ in_cinkeys(
                }
                else
                    // TODO: multi-byte
-                   if (keytyped == (int)p[-1] || (icase && keytyped < 256
+                   if (keytyped == (int)p[-1] || (icase
+                               && keytyped < 256 && keytyped >= 0
                         && TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1])))
                {
                    line = ml_get_cursor();
index b221faaae09cab40c6af4c36de3adc78c76d8a8e..562ba1317dd5a4a762b68a31cede13e6fe9a743c 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    22,
 /**/
     21,
 /**/