1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2022-11-25 16:31:51 +00:00
parent c1cf4c9107
commit ef2c325f5e
21 changed files with 143 additions and 68 deletions

View File

@@ -1150,7 +1150,7 @@ luaV_dict_newindex(lua_State *L)
if (lua_isnil(L, 3)) // remove?
{
hashitem_T *hi = hash_find(&d->dv_hashtab, di->di_key);
hash_remove(&d->dv_hashtab, hi);
hash_remove(&d->dv_hashtab, hi, "Lua new index");
dictitem_free(di);
}
else
@@ -1838,9 +1838,8 @@ luaV_setvar(lua_State *L)
if (di == NULL)
// Doesn't exist, nothing to do
return 0;
else
// Delete the entry
dictitem_remove(dict, di);
// Delete the entry
dictitem_remove(dict, di, "Lua delete variable");
}
else
{