Patch 9.0.0035

5 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 4, 2022, 8:37:53 AM7/4/22
to vim...@googlegroups.com

Patch 9.0.0035
Problem: Spell dump may go beyond end of an array.
Solution: Limit the word length.
Files: src/spell.c, src/testdir/test_spell.vim


*** ../vim-9.0.0034/src/spell.c 2022-06-09 19:53:29.000000000 +0100
--- src/spell.c 2022-07-04 13:31:18.789931930 +0100
***************
*** 3996,4004 ****
n = arridx[depth] + curi[depth];
++curi[depth];
c = byts[n];
! if (c == 0)
{
! // End of word, 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.
--- 3996,4005 ----
n = arridx[depth] + curi[depth];
++curi[depth];
c = byts[n];
! if (c == 0 || depth >= MAXWLEN - 1)
{
! // 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.
*** ../vim-9.0.0034/src/testdir/test_spell.vim 2022-07-04 11:03:03.548044326 +0100
--- src/testdir/test_spell.vim 2022-07-04 13:36:04.825322825 +0100
***************
*** 285,290 ****
--- 285,302 ----
bwipe!
endfunc

+ func Test_spell_dump_word_length()
+ " this was running over MAXWLEN
+ new
+ noremap 0 0a0zW0000000
+ sil! norm 0z=0
+ sil norm 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+ sil! norm 0z=0
+
+ bwipe!
+ nunmap 0
+ endfunc
+
" Test spellsuggest({word} [, {max} [, {capital}]])
func Test_spellsuggest()
" Verify suggestions are given even when spell checking is not enabled.
*** ../vim-9.0.0034/src/version.c 2022-07-04 11:03:03.548044326 +0100
--- src/version.c 2022-07-04 13:24:08.270357180 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 35,
/**/

--
hundred-and-one symptoms of being an internet addict:
42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth.

/// 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