diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-30 01:56:39 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-30 02:06:43 -0400 |
commit | 33ef9598145d5273234d6e7443d55d6f6ac0fa1e (patch) | |
tree | 8508fa2f0b3896197dde48d2abcbe3150d3b1675 /src | |
parent | cf7e351c24349c0351e19fbd4533f715d00bf87c (diff) | |
download | rneovim-33ef9598145d5273234d6e7443d55d6f6ac0fa1e.tar.gz rneovim-33ef9598145d5273234d6e7443d55d6f6ac0fa1e.tar.bz2 rneovim-33ef9598145d5273234d6e7443d55d6f6ac0fa1e.zip |
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.
https://github.com/vim/vim/commit/2f82ca7d79148ae931bf28a747ede06ba8a65de8
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 44560792f0..41a9eeeb40 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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'"); const char *title = NULL; int action = ' '; + static int recursive = 0; rettv->vval.v_number = -1; 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) { EMSG(_(e_listreq)); return; + } else if (recursive != 0) { + EMSG(_(e_au_recursive)); + return; } typval_T *action_arg = &args[1]; @@ -14712,10 +14716,12 @@ skip_args: title = (wp ? "setloclist()" : "setqflist()"); } + recursive++; list_T *const l = list_arg->vval.v_list; if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) { rettv->vval.v_number = 0; } + recursive--; } /* |