forked from aniani/vim
patch 8.1.1054: not checking return value of ga_grow()
Problem: Not checking return value of ga_grow(). (Coverity) Solution: Only append when ga_grow() returns OK.
This commit is contained in:
12
src/if_lua.c
12
src/if_lua.c
@@ -1144,9 +1144,9 @@ luaV_blob_add(lua_State *L)
|
|||||||
size_t i, l = 0;
|
size_t i, l = 0;
|
||||||
const char *s = lua_tolstring(L, 2, &l);
|
const char *s = lua_tolstring(L, 2, &l);
|
||||||
|
|
||||||
ga_grow(&b->bv_ga, l);
|
if (ga_grow(&b->bv_ga, l) == OK)
|
||||||
for (i = 0; i < l; ++i)
|
for (i = 0; i < l; ++i)
|
||||||
ga_append(&b->bv_ga, s[i]);
|
ga_append(&b->bv_ga, s[i]);
|
||||||
}
|
}
|
||||||
lua_settop(L, 1);
|
lua_settop(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1776,9 +1776,9 @@ luaV_blob(lua_State *L)
|
|||||||
size_t i, l = 0;
|
size_t i, l = 0;
|
||||||
const char *s = lua_tolstring(L, 1, &l);
|
const char *s = lua_tolstring(L, 1, &l);
|
||||||
|
|
||||||
ga_grow(&b->bv_ga, l);
|
if (ga_grow(&b->bv_ga, l) == OK)
|
||||||
for (i = 0; i < l; ++i)
|
for (i = 0; i < l; ++i)
|
||||||
ga_append(&b->bv_ga, s[i]);
|
ga_append(&b->bv_ga, s[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -775,6 +775,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 */
|
||||||
|
/**/
|
||||||
|
1054,
|
||||||
/**/
|
/**/
|
||||||
1053,
|
1053,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user