aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-12-31 20:08:18 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2015-01-08 21:10:46 +0100
commit0f029454ad086c670e674e6a610f3cf91fe27ecf (patch)
treecaac5fe00b654b6d9c0b7b69b9ee532947336060
parent641f79099f09966d4843cbcf12b3c4f864566e04 (diff)
downloadrneovim-0f029454ad086c670e674e6a610f3cf91fe27ecf.tar.gz
rneovim-0f029454ad086c670e674e6a610f3cf91fe27ecf.tar.bz2
rneovim-0f029454ad086c670e674e6a610f3cf91fe27ecf.zip
coverity/13758: Out-of-bounds read: FP.
Problem : Out-of-bounds read from a buffer. Diagnostic : False positive. Rationale : Suggested error path implies isupper(*str) being true, which makes error vanish. Coverity just fails to take into account isupper() postcondition. Resolution : Assert isupper() postcondition.
-rw-r--r--src/nvim/mark.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 4ded438f52..47c0c1be80 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -1219,8 +1219,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);