aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-17 19:36:21 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-17 19:37:44 -0500
commit486234ab3db56621767bea18a1783d289b660764 (patch)
treed0913718fedb02a64bb88c1c9db90895631a53f5
parent279ecaff00b5f7fed25cba0d6f131cb042420b20 (diff)
downloadrneovim-486234ab3db56621767bea18a1783d289b660764.tar.gz
rneovim-486234ab3db56621767bea18a1783d289b660764.tar.bz2
rneovim-486234ab3db56621767bea18a1783d289b660764.zip
vim-patch:8.1.0937: invalid memory access in search pattern
Problem: Invalid memory access in search pattern. (Kuang-che Wu) Solution: Check for incomplete collation element. (Dominique Pelle, closes vim/vim#3985) https://github.com/vim/vim/commit/f1b57ab2ab18032d19f64bff7d22f3adb3fe93f7
-rw-r--r--src/nvim/regexp.c2
-rw-r--r--src/nvim/testdir/test_regexp_latin.vim2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index b7fc39fdb3..53479294de 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -1103,7 +1103,7 @@ static int get_coll_element(char_u **pp)
int l = 1;
char_u *p = *pp;
- if (p[0] != NUL && p[1] == '.') {
+ if (p[0] != NUL && p[1] == '.' && p[2] != NUL) {
l = utfc_ptr2len(p + 2);
if (p[l + 2] == '.' && p[l + 3] == ']') {
c = utf_ptr2char(p + 2);
diff --git a/src/nvim/testdir/test_regexp_latin.vim b/src/nvim/testdir/test_regexp_latin.vim
index adbded128f..eb8f69ef15 100644
--- a/src/nvim/testdir/test_regexp_latin.vim
+++ b/src/nvim/testdir/test_regexp_latin.vim
@@ -44,4 +44,6 @@ func Test_get_equi_class()
" Incomplete equivalence class caused invalid memory access
s/^/[[=
call assert_equal(1, search(getline(1)))
+ s/.*/[[.
+ call assert_equal(1, search(getline(1)))
endfunc