]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4985: PVS warns for possible array underrun v8.2.4985
authorBram Moolenaar <Bram@vim.org>
Fri, 20 May 2022 13:10:50 +0000 (14:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 20 May 2022 13:10:50 +0000 (14:10 +0100)
Problem:    PVS warns for possible array underrun.
Solution:   Add a check for a positive value. (closes #10451)

src/spell.c
src/version.c

index e5c2f7d1f4e7eb4254cff3bc7c6393071785bdf6..48a2203e3f042b933b9885e870d7a330522ec441 100644 (file)
@@ -253,7 +253,7 @@ spell_check(
                                                             MAXWLEN + 1);
     mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
 
-    if (camel_case)
+    if (camel_case && mi.mi_fwordlen > 0)
        // Introduce a fake word end space into the folded word.
        mi.mi_fword[mi.mi_fwordlen - 1] = ' ';
 
index 40b81d1f3a9f7a76c1d5e1884797cc82f1ad20e5..09bf61d87664d3b754679c1051bd6dfca651db4c 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4985,
 /**/
     4984,
 /**/