diff options
| author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-13 00:09:49 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-13 00:18:50 -0400 |
| commit | 3e0188e92d9a4d359b501b3d431bfa7a79587679 (patch) | |
| tree | 4d8c5a51a213f9001cd1aae0287d65d335ad8708 /src/nvim/testdir | |
| parent | 315b7f8632076d882d498fc0bfab21a87ca75acb (diff) | |
| download | rneovim-3e0188e92d9a4d359b501b3d431bfa7a79587679.tar.gz rneovim-3e0188e92d9a4d359b501b3d431bfa7a79587679.tar.bz2 rneovim-3e0188e92d9a4d359b501b3d431bfa7a79587679.zip | |
vim-patch:8.0.0596: crash when complete() called after complete_add()
Problem: Crash when complete() is called after complete_add() in
'completefunc'. (Lifepillar)
Solution: Bail out if compl_pattern is NULL. (closes vim/vim#1668)
Also avoid using freed memory.
https://github.com/vim/vim/commit/4475b623960671898dac6a72b13a8d140402afa6
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_popup.vim | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index f5bdd717dd..ea98379f04 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -608,4 +608,47 @@ func Test_popup_and_preview_autocommand() bw! endfunc +fun MessCompleteMonths() + for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep") + call complete_add(m) + if complete_check() + break + endif + endfor + return [] +endfun + +fun MessCompleteMore() + call complete(1, split("Oct Nov Dec")) + return [] +endfun + +fun MessComplete(findstart, base) + if a:findstart + let line = getline('.') + let start = col('.') - 1 + while start > 0 && line[start - 1] =~ '\a' + let start -= 1 + endwhile + return start + else + call MessCompleteMonths() + call MessCompleteMore() + return [] + endif +endf + +func Test_complete_func_mess() + " Calling complete() after complete_add() in 'completefunc' is wrong, but it + " should not crash. + set completefunc=MessComplete + new + call setline(1, 'Ju') + call feedkeys("A\<c-x>\<c-u>/\<esc>", 'tx') + call assert_equal('Oct/Oct', getline(1)) + bwipe! + set completefunc= +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |