1
0
forked from aniani/vim

patch 9.0.0035: spell dump may go beyond end of an array

Problem:    Spell dump may go beyond end of an array.
Solution:   Limit the word length.
This commit is contained in:
Bram Moolenaar
2022-07-04 13:37:07 +01:00
parent 288ed23e39
commit 54e5fed6d2
3 changed files with 17 additions and 2 deletions

View File

@@ -3996,9 +3996,10 @@ spell_dump_compl(
n = arridx[depth] + curi[depth];
++curi[depth];
c = byts[n];
if (c == 0)
if (c == 0 || depth >= MAXWLEN - 1)
{
// End of word, deal with the word.
// End of word or reached maximum length, deal with the
// word.
// Don't use keep-case words in the fold-case tree,
// they will appear in the keep-case tree.
// Only use the word when the region matches.