vim-patch:9.0.0286: using freed memory when location list changed in autocmd

Problem:    Using freed memory when location list changed in autocmd.
Solution:   Return QF_ABORT and handle it. (Yegappan Lakshmanan,
            closes vim/vim#10993)
6d24a51b94
This commit is contained in:
zeertzjq
2022-10-13 11:10:30 +08:00
parent 5740b3e076
commit f72ae4514c
2 changed files with 41 additions and 13 deletions

View File

@@ -5886,5 +5886,22 @@ func Test_quickfixtextfunc_recursive()
cclose
endfunc
" Test for replacing the location list from an autocmd. This used to cause a
" read from freed memory.
func Test_loclist_replace_autocmd()
%bw!
call setloclist(0, [], 'f')
let s:bufnr = bufnr()
cal setloclist(0, [{'0': 0, '': ''}])
au BufEnter * cal setloclist(1, [{'t': ''}, {'bufnr': s:bufnr}], 'r')
lopen
try
exe "norm j\<CR>"
catch
endtry
lnext
%bw!
call setloclist(0, [], 'f')
endfunc
" vim: shiftwidth=2 sts=2 expandtab