Patch 8.2.4258
Problem:    Coverity warns for array overrun.
Solution:   Restrict depth to MAXWLEN - 1.
Files:      src/spellsuggest.c


*** ../vim-8.2.4257/src/spellsuggest.c  2022-01-29 11:22:11.827641991 +0000
--- src/spellsuggest.c  2022-01-30 12:07:12.509672469 +0000
***************
*** 1214,1220 ****
  
  // Check the maximum score, if we go over it we won't try this change.
  #define TRY_DEEPER(su, stack, depth, add) \
!          (depth < MAXWLEN && stack[depth].ts_score + (add) < su->su_maxscore)
  
  /*
   * Try finding suggestions by adding/removing/swapping letters.
--- 1214,1220 ----
  
  // Check the maximum score, if we go over it we won't try this change.
  #define TRY_DEEPER(su, stack, depth, add) \
!        (depth < MAXWLEN - 1 && stack[depth].ts_score + (add) < 
su->su_maxscore)
  
  /*
   * Try finding suggestions by adding/removing/swapping letters.
***************
*** 1373,1379 ****
  
                // At end of a prefix or at start of prefixtree: check for
                // following word.
!               if (depth < MAXWLEN
                            && (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
                {
                    // Set su->su_badflags to the caps type at this position.
--- 1373,1379 ----
  
                // At end of a prefix or at start of prefixtree: check for
                // following word.
!               if (depth < MAXWLEN - 1
                            && (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
                {
                    // Set su->su_badflags to the caps type at this position.
*** ../vim-8.2.4257/src/version.c       2022-01-29 21:45:30.489921423 +0000
--- src/version.c       2022-01-30 12:10:04.251593581 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4258,
  /**/

-- 
Friends?  I have lots of friends!  In fact, I have all episodes ever made.

 /// 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/20220130121104.A36941C1933%40moolenaar.net.

Raspunde prin e-mail lui