aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2015-01-08 20:43:00 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2015-01-08 22:51:53 +0100
commitaeb68bbb074ec20b51908f50f876d340d2dca020 (patch)
tree4dac9e697f6c3ef194257b2ad2ebef92feb61fa4
parentd96e1c1ec34cd57f860c677b7dd16ec92862225a (diff)
downloadrneovim-aeb68bbb074ec20b51908f50f876d340d2dca020.tar.gz
rneovim-aeb68bbb074ec20b51908f50f876d340d2dca020.tar.bz2
rneovim-aeb68bbb074ec20b51908f50f876d340d2dca020.zip
coverity/13763: Out-of-bounds read: FP.
Problem : Out-of-bound read from a buffer. Diagnostic : False positive. Rationale : nv_max_linear should always be less than nv_cmd_idx size (NV_CMDS_SIZE). Resolution : Assert rationale.
-rw-r--r--src/nvim/normal.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index e1dc2b93d9..e1aed23e8c 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -11,6 +11,7 @@
* the operators.
*/
+#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <string.h>
@@ -388,6 +389,7 @@ static int find_command(int cmdchar)
/* If the character is in the first part: The character is the index into
* nv_cmd_idx[]. */
+ assert(nv_max_linear < (int)NV_CMDS_SIZE);
if (cmdchar <= nv_max_linear)
return nv_cmd_idx[cmdchar];