vim-patch:8.0.1413: accessing freed memory in :cbuffer

Problem:    Accessing freed memory in :cbuffer.
Solution:   Get quickfix list after executing autocmds. (closes vim/vim#2470)
aaf6e43b7a
This commit is contained in:
Jan Edmund Lazo
2018-08-15 00:27:03 -04:00
parent 0bdd4e8393
commit ee37a0c79a
2 changed files with 14 additions and 5 deletions

View File

@@ -4541,11 +4541,6 @@ void ex_cbuffer(exarg_T *eap)
qf_info_T *qi = &ql_info; qf_info_T *qi = &ql_info;
const char *au_name = NULL; const char *au_name = NULL;
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
|| eap->cmdidx == CMD_laddbuffer) {
qi = ll_get_or_alloc_list(curwin);
}
switch (eap->cmdidx) { switch (eap->cmdidx) {
case CMD_cbuffer: case CMD_cbuffer:
au_name = "cbuffer"; au_name = "cbuffer";
@@ -4576,6 +4571,13 @@ void ex_cbuffer(exarg_T *eap)
} }
} }
// Must come after autocommands.
if (eap->cmdidx == CMD_lbuffer
|| eap->cmdidx == CMD_lgetbuffer
|| eap->cmdidx == CMD_laddbuffer) {
qi = ll_get_or_alloc_list(curwin);
}
if (*eap->arg == NUL) if (*eap->arg == NUL)
buf = curbuf; buf = curbuf;
else if (*skipwhite(skipdigits(eap->arg)) == NUL) else if (*skipwhite(skipdigits(eap->arg)) == NUL)

View File

@@ -1182,6 +1182,13 @@ func Test_nocatch_wipe_dummy_buffer()
au! au!
endfunc endfunc
func Test_wipe_cbuffer()
sv x
au * * bw
lb
au!
endfunc
" Test TextChangedI and TextChangedP " Test TextChangedI and TextChangedP
func Test_ChangedP() func Test_ChangedP()
" Nvim does not support test_override(). " Nvim does not support test_override().