vim-patch:8.0.0084

Problem:    Using freed memory when adding to a quickfix list. (Domenique
            Pelle)
Solution:   Clear the directory name.

7618e00d3b
This commit is contained in:
Jurica Bradaric 2017-07-16 17:39:53 +02:00
parent 875c356a83
commit e29ec131d6
3 changed files with 26 additions and 2 deletions

View File

@ -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;
}
/*

View File

@ -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

View File

@ -645,7 +645,7 @@ static const int included_patches[] = {
// 87 NA
// 86,
// 85,
// 84,
84,
83,
// 82 NA
// 81,