changeset 25583:7d3c296a117f v8.2.3328

patch 8.2.3328: Coverity error for not checking return value Commit: https://github.com/vim/vim/commit/b85d3627d9a7b41d603c58a16d0ddbf6b88beeaf Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 11 15:54:59 2021 +0200 patch 8.2.3328: Coverity error for not checking return value Problem: Coverity error for not checking return value. Solution: Check value is not negative.
author Bram Moolenaar <Bram@vim.org>
date Wed, 11 Aug 2021 16:00:06 +0200
parents 38e113f68d1e
children be8b76b05834
files src/spellfile.c src/version.c
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -1258,13 +1258,15 @@ read_compound(FILE *fd, slang_T *slang, 
 
 	gap = &slang->sl_comppat;
 	c = get2c(fd);					// <comppatcount>
+	if (c < 0)
+	    return SP_TRUNCERROR;
 	todo -= 2;
 	ga_init2(gap, sizeof(char_u *), c);
 	if (ga_grow(gap, c) == OK)
 	    while (--c >= 0)
 	    {
 		((char_u **)(gap->ga_data))[gap->ga_len++] =
-						 read_cnt_string(fd, 1, &cnt);
+						  read_cnt_string(fd, 1, &cnt);
 					    // <comppatlen> <comppattext>
 		if (cnt < 0)
 		    return cnt;
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3328,
+/**/
     3327,
 /**/
     3326,