Skip to content

Commit a9a8e04

Browse files
committed
patch 8.1.0501: cppcheck warns for using array index before bounds check
Problem: Cppcheck warns for using array index before bounds check. Solution: Swap the conditions. (Dominique Pelle)
1 parent 833e5da commit a9a8e04

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/memline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5029,8 +5029,8 @@ ml_updatechunk(
50295029
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;
50305030
}
50315031
}
5032-
else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines
5033-
&& curix < buf->b_ml.ml_usedchunks - 1)
5032+
else if (curix < buf->b_ml.ml_usedchunks - 1
5033+
&& line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines)
50345034
{
50355035
/* Adjust cached curix & curline */
50365036
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ static char *(features[]) =
792792

793793
static int included_patches[] =
794794
{ /* Add new patch number below this line */
795+
/**/
796+
501,
795797
/**/
796798
500,
797799
/**/

0 commit comments

Comments
 (0)