0
0
mirror of https://github.com/vim/vim.git synced 2025-07-25 10:54:51 -04:00

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 #2473)
This commit is contained in:
Bram Moolenaar 2017-12-19 16:48:55 +01:00
parent aaf6e43b7a
commit 14a4deb064
3 changed files with 14 additions and 4 deletions

View File

@ -4068,10 +4068,6 @@ ex_cfile(exarg_T *eap)
#endif
int res;
if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
|| eap->cmdidx == CMD_laddfile)
wp = curwin;
#ifdef FEAT_AUTOCMD
switch (eap->cmdidx)
{
@ -4104,6 +4100,11 @@ ex_cfile(exarg_T *eap)
if (*eap->arg != NUL)
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE, 0);
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
* commands.

View File

@ -3031,3 +3031,10 @@ func Test_ll_window_ctx()
enew | only
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

View File

@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1414,
/**/
1413,
/**/