diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2017-07-16 17:39:53 +0200 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2017-07-16 17:48:50 +0200 |
commit | e29ec131d67f3410dba85ab13ba4c617e5768269 (patch) | |
tree | 2f7881384c2ba2cb28006eb3fc5014f89fb259ea | |
parent | 875c356a83b07573b87b2995478fc3b0703bc023 (diff) | |
download | rneovim-e29ec131d67f3410dba85ab13ba4c617e5768269.tar.gz rneovim-e29ec131d67f3410dba85ab13ba4c617e5768269.tar.bz2 rneovim-e29ec131d67f3410dba85ab13ba4c617e5768269.zip |
vim-patch:8.0.0084
Problem: Using freed memory when adding to a quickfix list. (Domenique
Pelle)
Solution: Clear the directory name.
https://github.com/vim/vim/commit/7618e00d3b8bfe064cfc524640d754607361f9df
-rw-r--r-- | src/nvim/quickfix.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 22 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 44469a77df..f17075f0c4 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1417,7 +1417,7 @@ void copy_loclist(win_T *from, win_T *to) to->w_llist->qf_curlist = qi->qf_curlist; /* current list */ } -// Get buffer number for file "directory.fname". +// Get buffer number for file "directory/fname". // Also sets the b_has_qf_entry flag. static int qf_get_fnum(qf_info_T *qi, char_u *directory, char_u *fname) { @@ -2371,7 +2371,9 @@ static void qf_free(qf_info_T *qi, int idx) qi->qf_lists[idx].qf_index = 0; qf_clean_dir_stack(&qi->qf_dir_stack); + qi->qf_directory = NULL; qf_clean_dir_stack(&qi->qf_file_stack); + qi->qf_currfile = NULL; } /* diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 08a749f65e..aff5fc2eed 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1651,3 +1651,25 @@ func Test_caddexpr_wrong() call assert_fails('caddexpr ""', 'E376:') let &efm = save_efm endfunc + +func Test_dirstack_cleanup() + " This used to cause a memory access in freed memory. + let save_efm = &efm + lexpr '0' + lopen + fun X(c) + let save_efm=&efm + set efm=%D%f + if a:c == 'c' + caddexpr '::' + else + laddexpr ':0:0' + endif + let &efm=save_efm + endfun + call X('c') + call X('l') + call setqflist([], 'r') + caddbuffer + let &efm = save_efm +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index 62af3ab34d..2beb13edf8 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -645,7 +645,7 @@ static const int included_patches[] = { // 87 NA // 86, // 85, - // 84, + 84, 83, // 82 NA // 81, |