forked from aniani/vim
patch 8.2.4258: Coverity warns for array overrun
Problem: Coverity warns for array overrun. Solution: Restrict depth to MAXWLEN - 1.
This commit is contained in:
parent
f10911e5db
commit
6970e1e36a
@ -1214,7 +1214,7 @@ suggest_try_change(suginfo_T *su)
|
|||||||
|
|
||||||
// Check the maximum score, if we go over it we won't try this change.
|
// Check the maximum score, if we go over it we won't try this change.
|
||||||
#define TRY_DEEPER(su, stack, depth, add) \
|
#define TRY_DEEPER(su, stack, depth, add) \
|
||||||
(depth < MAXWLEN && stack[depth].ts_score + (add) < su->su_maxscore)
|
(depth < MAXWLEN - 1 && stack[depth].ts_score + (add) < su->su_maxscore)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try finding suggestions by adding/removing/swapping letters.
|
* Try finding suggestions by adding/removing/swapping letters.
|
||||||
@ -1373,7 +1373,7 @@ suggest_trie_walk(
|
|||||||
|
|
||||||
// At end of a prefix or at start of prefixtree: check for
|
// At end of a prefix or at start of prefixtree: check for
|
||||||
// following word.
|
// following word.
|
||||||
if (depth < MAXWLEN
|
if (depth < MAXWLEN - 1
|
||||||
&& (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
|
&& (byts[arridx] == 0 || n == (int)STATE_NOPREFIX))
|
||||||
{
|
{
|
||||||
// Set su->su_badflags to the caps type at this position.
|
// Set su->su_badflags to the caps type at this position.
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4258,
|
||||||
/**/
|
/**/
|
||||||
4257,
|
4257,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user