1
0
forked from aniani/vim

patch 8.2.4919: can add invalid bytes with :spellgood

Problem:    Can add invalid bytes with :spellgood.
Solution:   Check for a valid word string.
This commit is contained in:
Bram Moolenaar
2022-05-08 22:32:58 +01:00
parent 9830db6305
commit 7c824682d2
5 changed files with 22 additions and 1 deletions

View File

@@ -4390,6 +4390,10 @@ store_word(
int res = OK;
char_u *p;
// Avoid adding illegal bytes to the word tree.
if (enc_utf8 && !utf_valid_string(word, NULL))
return FAIL;
(void)spell_casefold(curwin, word, len, foldword, MAXWLEN);
for (p = pfxlist; res == OK; ++p)
{
@@ -6190,6 +6194,12 @@ spell_add_word(
int i;
char_u *spf;
if (enc_utf8 && !utf_valid_string(word, NULL))
{
emsg(_(e_illegal_character_in_word));
return;
}
if (idx == 0) // use internal wordlist
{
if (int_wordlist == NULL)