diff options
-rw-r--r-- | src/nvim/mark.c | 5 | ||||
-rw-r--r-- | src/nvim/normal.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 4ded438f52..ef9f0ca408 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -127,6 +127,7 @@ int setmark_pos(int c, pos_T *pos, int fnum) return OK; } if (isupper(c)) { + assert(c >= 'A' && c <= 'Z'); i = c - 'A'; namedfm[i].fmark.mark = *pos; namedfm[i].fmark.fnum = fnum; @@ -1219,8 +1220,10 @@ int read_viminfo_filemark(vir_T *virp, int force) } } else if (VIM_ISDIGIT(*str)) fm = &namedfm[*str - '0' + NMARKS]; - else + else { // is uppercase + assert(*str >= 'A' && *str <= 'Z'); fm = &namedfm[*str - 'A']; + } if (fm != NULL && (fm->fmark.mark.lnum == 0 || force)) { str = skipwhite(str + 1); fm->fmark.mark.lnum = getdigits(&str); 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]; |