aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-01-22 21:59:54 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-01-23 15:49:37 +0100
commit6be8ea07872ac8badd3645a51017c32b0b90d59e (patch)
treec5dfe65972d33e0d65deb5daaf291eb9be35d63c /src
parent73da522d73c5d686c122ea4482d03e576a6a242c (diff)
downloadrneovim-6be8ea07872ac8badd3645a51017c32b0b90d59e.tar.gz
rneovim-6be8ea07872ac8badd3645a51017c32b0b90d59e.tar.bz2
rneovim-6be8ea07872ac8badd3645a51017c32b0b90d59e.zip
coverity/133845: Negative array index read. (FP)
`find_command(s->ca.cmdchar) >= 0` was established near the start of normal_execute(). And `unshift_special(&s->ca);` "should" not ever result in s->ca.cmdchar containing a multibyte char. So only an assert() is needed here.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/normal.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 9db02de2a6..b17b4c584e 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1130,6 +1130,7 @@ static int normal_execute(VimState *state, int key)
start_selection();
unshift_special(&s->ca);
s->idx = find_command(s->ca.cmdchar);
+ assert(s->idx >= 0);
} else if ((nv_cmds[s->idx].cmd_flags & NV_SSS)
&& (mod_mask & MOD_MASK_SHIFT)) {
start_selection();