regexp: Fix invalid multibyte reads at end of strings

Close #3150
This commit is contained in:
Thiago de Arruda
2015-09-08 13:03:09 -03:00
parent c708061a5a
commit 0a116c828d
2 changed files with 2 additions and 1 deletions

View File

@@ -653,7 +653,7 @@ int searchit(
}
if (matchcol == 0 && (options & SEARCH_START))
break;
if (ptr[matchcol] == NUL
if (STRLEN(ptr) <= (size_t)matchcol || ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(&regmatch,
win, buf, lnum + matchpos.lnum,
matchcol,