Mercurial > vim
diff src/vim9script.c @ 31231:684e6dfa2fba v9.0.0949
patch 9.0.0949: crash when unletting a variable while listing variables
Commit: https://github.com/vim/vim/commit/ef2c325f5e3c437b722bb96bf369ba2a5c541163
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 25 16:31:51 2022 +0000
patch 9.0.0949: crash when unletting a variable while listing variables
Problem: Crash when unletting a variable while listing variables.
Solution: Disallow changing a hashtable while going over the entries.
(closes #11435)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 25 Nov 2022 17:45:04 +0100 |
parents | 12e6c7bae2a9 |
children | 307f68a41b03 |
line wrap: on
line diff
--- a/src/vim9script.c +++ b/src/vim9script.c @@ -942,7 +942,8 @@ update_vim9_script_var( if (HASHITEM_EMPTY(hi)) // new variable name - hash_add(&si->sn_all_vars.dv_hashtab, newsav->sav_key); + hash_add(&si->sn_all_vars.dv_hashtab, newsav->sav_key, + "add variable"); else if (sav != NULL) // existing name in a new block, append to the list sav->sav_next = newsav; @@ -1033,7 +1034,7 @@ hide_script_var(scriptitem_T *si, int id else { if (sav_prev == NULL) - hash_remove(all_ht, all_hi); + hash_remove(all_ht, all_hi, "hide variable"); else sav_prev->sav_next = sav->sav_next; sv->sv_name = NULL;