From 0f029454ad086c670e674e6a610f3cf91fe27ecf Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Wed, 31 Dec 2014 20:08:18 +0100 Subject: 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. --- src/nvim/mark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit