From a9a8e04eab106c1d21381f79f8965fe50b94e235 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 30 Oct 2018 22:15:55 +0100 Subject: [PATCH] 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) --- src/memline.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/memline.c b/src/memline.c index 9789349fa..1d65a44d8 100644 --- a/src/memline.c +++ b/src/memline.c @@ -5029,8 +5029,8 @@ ml_updatechunk( curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; } } - else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines - && curix < buf->b_ml.ml_usedchunks - 1) + else if (curix < buf->b_ml.ml_usedchunks - 1 + && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) { /* Adjust cached curix & curline */ curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; diff --git a/src/version.c b/src/version.c index 9d700e2ba..73d06215f 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 501, /**/ 500, /**/ -- 2.50.1