0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

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.
This commit is contained in:
Bram Moolenaar
2021-08-11 15:54:59 +02:00
parent ba9c23e776
commit b85d3627d9
2 changed files with 5 additions and 1 deletions

View File

@@ -1258,13 +1258,15 @@ read_compound(FILE *fd, slang_T *slang, int len)
gap = &slang->sl_comppat; gap = &slang->sl_comppat;
c = get2c(fd); // <comppatcount> c = get2c(fd); // <comppatcount>
if (c < 0)
return SP_TRUNCERROR;
todo -= 2; todo -= 2;
ga_init2(gap, sizeof(char_u *), c); ga_init2(gap, sizeof(char_u *), c);
if (ga_grow(gap, c) == OK) if (ga_grow(gap, c) == OK)
while (--c >= 0) while (--c >= 0)
{ {
((char_u **)(gap->ga_data))[gap->ga_len++] = ((char_u **)(gap->ga_data))[gap->ga_len++] =
read_cnt_string(fd, 1, &cnt); read_cnt_string(fd, 1, &cnt);
// <comppatlen> <comppattext> // <comppatlen> <comppattext>
if (cnt < 0) if (cnt < 0)
return cnt; return cnt;

View File

@@ -755,6 +755,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 */
/**/
3328,
/**/ /**/
3327, 3327,
/**/ /**/