patch 9.1.0022: Coverity complains about improper use of negative value
Commit:
https://github.com/vim/vim/commit/49471963fefbdf78239d9066d84e14e1876fb177
Author: Christian Brabandt <[email protected]>
Date: Fri Jan 12 17:48:08 2024 +0100
patch 9.1.0022: Coverity complains about improper use of negative value
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 <[email protected]>
diff --git a/src/cindent.c b/src/cindent.c
index 62894228b..cf18441f6 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -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();
diff --git a/src/version.c b/src/version.c
index b221faaae..562ba1317 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 22,
/**/
21,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1rOKt2-008htH-HB%40256bit.org.