Skip to content

Commit

Permalink
patch 8.2.3582: reading uninitialized memory when giving spell sugges…
Browse files Browse the repository at this point in the history
…tions

Problem:    Reading uninitialized memory when giving spell suggestions.
Solution:   Check that preword is not empty.
  • Loading branch information
brammool committed Nov 4, 2021
1 parent 0b5b06c commit 15d9890
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/spellsuggest.c
Expand Up @@ -1619,7 +1619,7 @@ suggest_trie_walk(
// char, e.g., "thes," -> "these".
p = fword + sp->ts_fidx;
MB_PTR_BACK(fword, p);
if (!spell_iswordp(p, curwin))
if (!spell_iswordp(p, curwin) && *preword != NUL)
{
p = preword + STRLEN(preword);
MB_PTR_BACK(preword, p);
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/test_spell.vim
Expand Up @@ -839,6 +839,14 @@ func Test_spell_screendump()
call delete('XtestSpell')
endfunc

func Test_spell_single_word()
new
silent! norm 0R00
spell! ßÂ
silent 0norm 0r$ Dvz=
bwipe!
endfunc

let g:test_data_aff1 = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -757,6 +757,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3582,
/**/
3581,
/**/
Expand Down

0 comments on commit 15d9890

Please sign in to comment.