diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-11-04 15:46:05 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-11-04 15:46:05 +0000 |
commit | 15d9890eee53afc61eb0a03b878a19cb5672f732 (patch) | |
tree | 3f784dedd6d11db994fbb6440e10fe4838ec2314 | |
parent | 0b5b06cb4777d1401fdf83e7d48d287662236e7e (diff) | |
download | vim-git-15d9890eee53afc61eb0a03b878a19cb5672f732.tar.gz |
patch 8.2.3582: reading uninitialized memory when giving spell suggestionsv8.2.3582
Problem: Reading uninitialized memory when giving spell suggestions.
Solution: Check that preword is not empty.
-rw-r--r-- | src/spellsuggest.c | 2 | ||||
-rw-r--r-- | src/testdir/test_spell.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/spellsuggest.c b/src/spellsuggest.c index a6dbc78a4..255f94de0 100644 --- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -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); diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim index a3a9621cb..b7437fd44 100644 --- a/src/testdir/test_spell.vim +++ b/src/testdir/test_spell.vim @@ -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", diff --git a/src/version.c b/src/version.c index 7bb423636..73ba32ef2 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3582, +/**/ 3581, /**/ 3580, |