diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-09-08 13:03:09 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-09-18 14:35:26 -0300 |
commit | 0a116c828debc6192a6bfb6bceb8cf020e867db0 (patch) | |
tree | bc0b9b6e8d7e4c27ecb5ac19d487498ac3735986 | |
parent | c708061a5a9b1bb75f06c6de0b5c02f3a0abad4d (diff) | |
download | rneovim-0a116c828debc6192a6bfb6bceb8cf020e867db0.tar.gz rneovim-0a116c828debc6192a6bfb6bceb8cf020e867db0.tar.bz2 rneovim-0a116c828debc6192a6bfb6bceb8cf020e867db0.zip |
regexp: Fix invalid multibyte reads at end of strings
Close #3150
-rw-r--r-- | src/nvim/regexp_nfa.c | 1 | ||||
-rw-r--r-- | src/nvim/search.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 484dfe1e1f..4cd422400f 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -4781,6 +4781,7 @@ static long find_match_text(colnr_T startcol, int regstart, char_u *match_text) if (match /* check that no composing char follows */ && !(enc_utf8 + && STRLEN(regline) > (size_t)(col + len2) && utf_iscomposing(PTR2CHAR(regline + col + len2))) ) { cleanup_subexpr(); diff --git a/src/nvim/search.c b/src/nvim/search.c index ff5c5f834f..a758e02105 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -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(®match, win, buf, lnum + matchpos.lnum, matchcol, |