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)
diff --git a/src/spellfile.c b/src/spellfile.c
index b5db526..6247968 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -2643,7 +2643,7 @@
smsg(_("Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"),
fname, lnum, items[1]);
STRCPY(cur_aff->ah_key, items[1]);
- hash_add(tp, cur_aff->ah_key);
+ hash_add(tp, cur_aff->ah_key, "spelling");
cur_aff->ah_combine = (*items[2] == 'Y');
}
@@ -2994,7 +2994,7 @@
p = vim_strsave(items[i]);
if (p == NULL)
break;
- hash_add(&spin->si_commonwords, p);
+ hash_add(&spin->si_commonwords, p, "spelling");
}
}
}
@@ -3312,7 +3312,7 @@
id = spin->si_newcompID--;
} while (vim_strchr((char_u *)"/?*+[]\\-^", id) != NULL);
ci->ci_newID = id;
- hash_add(&aff->af_comp, ci->ci_key);
+ hash_add(&aff->af_comp, ci->ci_key, "spelling");
}
*tp++ = id;
}