diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-02-17 19:34:19 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-02-17 19:35:41 -0500 |
commit | 279ecaff00b5f7fed25cba0d6f131cb042420b20 (patch) | |
tree | 5f047a84fec520ba9a8f53bda1a02a1b34a51e5b /src | |
parent | d8b4fb7838eb6e9ff907bb014144fef9b6cd2933 (diff) | |
download | rneovim-279ecaff00b5f7fed25cba0d6f131cb042420b20.tar.gz rneovim-279ecaff00b5f7fed25cba0d6f131cb042420b20.tar.bz2 rneovim-279ecaff00b5f7fed25cba0d6f131cb042420b20.zip |
vim-patch:8.1.0934: invalid memory access in search pattern
Problem: Invalid memory access in search pattern. (Kuang-che Wu)
Solution: Check for incomplete equivalence class. (closes vim/vim#3970)
https://github.com/vim/vim/commit/985079c514e9ab85598b7bca019c77d3e42526f5
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/regexp.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_regexp_latin.vim | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index a70b150e9b..b7fc39fdb3 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -772,7 +772,7 @@ static int get_equi_class(char_u **pp) int l = 1; char_u *p = *pp; - if (p[1] == '=') { + if (p[1] == '=' && p[2] != NUL) { l = (*mb_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 e31bb08b19..adbded128f 100644 --- a/src/nvim/testdir/test_regexp_latin.vim +++ b/src/nvim/testdir/test_regexp_latin.vim @@ -38,3 +38,10 @@ func Test_range_with_newline() call assert_equal(0, search("[ -*\\t-\\n]")) bwipe! endfunc + +func Test_get_equi_class() + new + " Incomplete equivalence class caused invalid memory access + s/^/[[= + call assert_equal(1, search(getline(1))) +endfunc |