Mercurial > vim
changeset 13078:a1f8939a4644 v8.0.1414
patch 8.0.1414: accessing freed memory in :lfile.
commit https://github.com/vim/vim/commit/14a4deb064610c30a50f00d524dde9b3292aad59
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 19 16:48:55 2017 +0100
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2017 17:00:08 +0100 |
parents | 519ff3efa2e2 |
children | de71c1f24efa |
files | src/quickfix.c src/testdir/test_quickfix.vim src/version.c |
diffstat | 3 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -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.
--- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -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