Mercurial > vim
diff src/if_ruby.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 | 425b686c5244 |
children | d8e7d725a666 |
line wrap: on
line diff
--- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -1799,7 +1799,7 @@ convert_hash2dict(VALUE key, VALUE val, if (di == NULL || ruby_convert_to_vim_value(val, &di->di_tv) != OK || dict_add(d, di) != OK) { - d->dv_hashtab.ht_error = TRUE; + d->dv_hashtab.ht_flags |= HTFLAGS_ERROR; return ST_STOP; } return ST_CONTINUE; @@ -1879,7 +1879,7 @@ ruby_convert_to_vim_value(VALUE val, typ return FAIL; rb_hash_foreach(val, convert_hash2dict, (VALUE)d); - if (d->dv_hashtab.ht_error) + if (d->dv_hashtab.ht_flags & HTFLAGS_ERROR) { dict_unref(d); return FAIL;