Skip to content

Commit 2f82ca7

Browse files
committed
patch 8.1.0068: nasty autocommands can still cause using freed memory
Problem: Nasty autocommands can still cause using freed memory. Solution: Disallow using setloclist() and setqflist() recursively.
1 parent a5616b0 commit 2f82ca7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: src/evalfunc.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -10621,13 +10621,16 @@ set_qf_ll_list(
1062110621
static char *e_invact = N_("E927: Invalid action: '%s'");
1062210622
char_u *act;
1062310623
int action = 0;
10624+
static int recursive = 0;
1062410625
#endif
1062510626

1062610627
rettv->vval.v_number = -1;
1062710628

1062810629
#ifdef FEAT_QUICKFIX
1062910630
if (list_arg->v_type != VAR_LIST)
1063010631
EMSG(_(e_listreq));
10632+
else if (recursive != 0)
10633+
EMSG(_(e_au_recursive));
1063110634
else
1063210635
{
1063310636
list_T *l = list_arg->vval.v_list;
@@ -10662,9 +10665,12 @@ set_qf_ll_list(
1066210665
}
1066310666
}
1066410667

10668+
++recursive;
1066510669
if (l != NULL && action && valid_dict && set_errorlist(wp, l, action,
10666-
(char_u *)(wp == NULL ? ":setqflist()" : ":setloclist()"), d) == OK)
10670+
(char_u *)(wp == NULL ? ":setqflist()" : ":setloclist()"),
10671+
d) == OK)
1066710672
rettv->vval.v_number = 0;
10673+
--recursive;
1066810674
}
1066910675
#endif
1067010676
}

Diff for: src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
68,
764766
/**/
765767
67,
766768
/**/

0 commit comments

Comments
 (0)