mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1414: accessing freed memory in :lfile.
Problem: Accessing freed memory in :lfile.
Solution: Get the current window after executing autocommands. (Yegappan
Lakshmanan, closes vim/vim#2473)
14a4deb064
This commit is contained in:
parent
427140048b
commit
0234d579a7
@ -3767,10 +3767,6 @@ void ex_cfile(exarg_T *eap)
|
|||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
|
|
||||||
|| eap->cmdidx == CMD_laddfile)
|
|
||||||
wp = curwin;
|
|
||||||
|
|
||||||
switch (eap->cmdidx) {
|
switch (eap->cmdidx) {
|
||||||
case CMD_cfile: au_name = (char_u *)"cfile"; break;
|
case CMD_cfile: au_name = (char_u *)"cfile"; break;
|
||||||
case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break;
|
case CMD_cgetfile: au_name = (char_u *)"cgetfile"; break;
|
||||||
@ -3786,6 +3782,13 @@ void ex_cfile(exarg_T *eap)
|
|||||||
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);
|
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);
|
||||||
|
|
||||||
char_u *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
char_u *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
||||||
|
|
||||||
|
if (eap->cmdidx == CMD_lfile
|
||||||
|
|| eap->cmdidx == CMD_lgetfile
|
||||||
|
|| eap->cmdidx == CMD_laddfile) {
|
||||||
|
wp = curwin;
|
||||||
|
}
|
||||||
|
|
||||||
// This function is used by the :cfile, :cgetfile and :caddfile
|
// This function is used by the :cfile, :cgetfile and :caddfile
|
||||||
// commands.
|
// commands.
|
||||||
// :cfile always creates a new quickfix list and jumps to the
|
// :cfile always creates a new quickfix list and jumps to the
|
||||||
|
@ -3312,3 +3312,10 @@ func Test_ll_window_ctx()
|
|||||||
enew | only
|
enew | only
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" The following test used to crash vim
|
||||||
|
func Test_lfile_crash()
|
||||||
|
sp Xtest
|
||||||
|
au QuickFixCmdPre * bw
|
||||||
|
call assert_fails('lfile', 'E40')
|
||||||
|
au! QuickFixCmdPre
|
||||||
|
endfunc
|
||||||
|
Loading…
Reference in New Issue
Block a user