aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-13 13:23:42 +0800
committerGitHub <noreply@github.com>2024-01-13 13:23:42 +0800
commit89b0f5ac5a29799ad9effa1dad3c4f274b09d570 (patch)
tree53a75974302c006fb77d47562c6b2f8a6cf815c5 /src/nvim/edit.c
parent786089013d33666a2acb5ba86fb34c716a9cab26 (diff)
downloadrneovim-89b0f5ac5a29799ad9effa1dad3c4f274b09d570.tar.gz
rneovim-89b0f5ac5a29799ad9effa1dad3c4f274b09d570.tar.bz2
rneovim-89b0f5ac5a29799ad9effa1dad3c4f274b09d570.zip
vim-patch:9.1.0022: Coverity complains about improper use of negative value (#27001)
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: vim/vim#13824 https://github.com/vim/vim/commit/49471963fefbdf78239d9066d84e14e1876fb177 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 4b472a2fbd..3006f423dc 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3170,7 +3170,7 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
} else {
// TODO(@brammool): multi-byte
if (keytyped == (int)(uint8_t)p[-1]
- || (icase && keytyped < 256
+ || (icase && keytyped < 256 && keytyped >= 0
&& TOLOWER_LOC(keytyped) == TOLOWER_LOC((uint8_t)p[-1]))) {
char *line = get_cursor_pos_ptr();
assert(p >= look && (uintmax_t)(p - look) <= SIZE_MAX);