summaryrefslogtreecommitdiffstats
path: root/src/cindent.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-01-12 17:48:08 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-12 17:48:08 +0100
commit49471963fefbdf78239d9066d84e14e1876fb177 (patch)
treecfedd90073809d663495af4f8ceaeaa351c5c13b /src/cindent.c
parent424ec1f235a53131042aed94d30f6e2528e551d9 (diff)
patch 9.1.0022: Coverity complains about improper use of negative valuev9.1.0022
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>
Diffstat (limited to 'src/cindent.c')
-rw-r--r--src/cindent.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cindent.c b/src/cindent.c
index 62894228b1..cf18441f60 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();