Mercurial > vim
changeset 26098:25b93e560a7c v8.2.3582
patch 8.2.3582: reading uninitialized memory when giving spell suggestions
Commit: https://github.com/vim/vim/commit/15d9890eee53afc61eb0a03b878a19cb5672f732
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 4 15:46:05 2021 +0000
patch 8.2.3582: reading uninitialized memory when giving spell suggestions
Problem: Reading uninitialized memory when giving spell suggestions.
Solution: Check that preword is not empty.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Nov 2021 17:00:07 +0100 |
parents | cc33435a9f8b |
children | 7dbc843d95ff |
files | src/spellsuggest.c src/testdir/test_spell.vim src/version.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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",