diff src/spellfile.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 360f286b5869
children 543153d582d5
line wrap: on
line diff
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -2643,7 +2643,7 @@ spell_read_aff(spellinfo_T *spin, char_u
 			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 @@ spell_read_aff(spellinfo_T *spin, char_u
 			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 @@ process_compflags(
 			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;
 	    }