forked from aniani/vim
patch 8.0.1413: accessing freed memory in :cbuffer
Problem: Accessing freed memory in :cbuffer. Solution: Get quickfix list after executing autocmds. (closes #2470)
This commit is contained in:
@@ -5520,14 +5520,6 @@ ex_cbuffer(exarg_T *eap)
|
|||||||
#endif
|
#endif
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
|
|
||||||
|| eap->cmdidx == CMD_laddbuffer)
|
|
||||||
{
|
|
||||||
qi = ll_get_or_alloc_list(curwin);
|
|
||||||
if (qi == NULL)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#ifdef FEAT_AUTOCMD
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
@@ -5549,6 +5541,15 @@ ex_cbuffer(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 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 (qi == NULL)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@@ -1178,3 +1178,10 @@ func Test_nocatch_wipe_dummy_buffer()
|
|||||||
call assert_fails('lv½ /x', 'E480')
|
call assert_fails('lv½ /x', 'E480')
|
||||||
au!
|
au!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_wipe_cbuffer()
|
||||||
|
sv x
|
||||||
|
au * * bw
|
||||||
|
lb
|
||||||
|
au!
|
||||||
|
endfunc
|
||||||
|
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1413,
|
||||||
/**/
|
/**/
|
||||||
1412,
|
1412,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user