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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220704123744.91E691C091A%40moolenaar.net.

Raspunde prin e-mail lui