mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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.
2f82ca7d79
This commit is contained in:
parent
cf7e351c24
commit
33ef959814
@ -14664,6 +14664,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
|
|||||||
static char *e_invact = N_("E927: Invalid action: '%s'");
|
static char *e_invact = N_("E927: Invalid action: '%s'");
|
||||||
const char *title = NULL;
|
const char *title = NULL;
|
||||||
int action = ' ';
|
int action = ' ';
|
||||||
|
static int recursive = 0;
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
dict_T *d = NULL;
|
dict_T *d = NULL;
|
||||||
|
|
||||||
@ -14671,6 +14672,9 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
|
|||||||
if (list_arg->v_type != VAR_LIST) {
|
if (list_arg->v_type != VAR_LIST) {
|
||||||
EMSG(_(e_listreq));
|
EMSG(_(e_listreq));
|
||||||
return;
|
return;
|
||||||
|
} else if (recursive != 0) {
|
||||||
|
EMSG(_(e_au_recursive));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typval_T *action_arg = &args[1];
|
typval_T *action_arg = &args[1];
|
||||||
@ -14712,10 +14716,12 @@ skip_args:
|
|||||||
title = (wp ? "setloclist()" : "setqflist()");
|
title = (wp ? "setloclist()" : "setqflist()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recursive++;
|
||||||
list_T *const l = list_arg->vval.v_list;
|
list_T *const l = list_arg->vval.v_list;
|
||||||
if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) {
|
if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) {
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
}
|
}
|
||||||
|
recursive--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user