Patch 8.2.3582

16 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 4, 2021, 11:46:48 AM11/4/21
to vim...@googlegroups.com

Patch 8.2.3582
Problem: Reading uninitialized memory when giving spell suggestions.
Solution: Check that preword is not empty.
Files: src/spellsuggest.c, src/testdir/test_spell.vim


*** ../vim-8.2.3581/src/spellsuggest.c 2021-10-06 13:41:03.592314063 +0100
--- src/spellsuggest.c 2021-11-04 15:44:09.185493280 +0000
***************
*** 1619,1625 ****
// char, e.g., "thes," -> "these".
p = fword + sp->ts_fidx;
MB_PTR_BACK(fword, p);
! if (!spell_iswordp(p, curwin))
{
p = preword + STRLEN(preword);
MB_PTR_BACK(preword, p);
--- 1619,1625 ----
// char, e.g., "thes," -> "these".
p = fword + sp->ts_fidx;
MB_PTR_BACK(fword, p);
! if (!spell_iswordp(p, curwin) && *preword != NUL)
{
p = preword + STRLEN(preword);
MB_PTR_BACK(preword, p);
*** ../vim-8.2.3581/src/testdir/test_spell.vim 2020-10-07 11:58:41.157858444 +0100
--- src/testdir/test_spell.vim 2021-11-04 15:37:38.227993023 +0000
***************
*** 839,844 ****
--- 839,852 ----
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",
*** ../vim-8.2.3581/src/version.c 2021-11-04 15:10:07.361074289 +0000
--- src/version.c 2021-11-04 15:35:14.638177819 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3582,
/**/

--
TALL KNIGHT OF NI: Ni!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages