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