changeset 16099:643fe07aa0e2 v8.1.1054

patch 8.1.1054: not checking return value of ga_grow() commit https://github.com/vim/vim/commit/6fb5c97242a151e67bd5c72736f187ef71c44e24 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 26 21:44:20 2019 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 Mar 2019 21:45:06 +0100
parents 8b7c4bb10373
children 1c8969addd04
files src/if_lua.c src/version.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -1144,9 +1144,9 @@ luaV_blob_add(lua_State *L)
 	size_t i, l = 0;
 	const char *s = lua_tolstring(L, 2, &l);
 
-	ga_grow(&b->bv_ga, l);
-	for (i = 0; i < l; ++i)
-	    ga_append(&b->bv_ga, s[i]);
+	if (ga_grow(&b->bv_ga, l) == OK)
+	    for (i = 0; i < l; ++i)
+		ga_append(&b->bv_ga, s[i]);
     }
     lua_settop(L, 1);
     return 1;
@@ -1776,9 +1776,9 @@ luaV_blob(lua_State *L)
 	    size_t i, l = 0;
 	    const char *s = lua_tolstring(L, 1, &l);
 
-	    ga_grow(&b->bv_ga, l);
-	    for (i = 0; i < l; ++i)
-		ga_append(&b->bv_ga, s[i]);
+	    if (ga_grow(&b->bv_ga, l) == OK)
+		for (i = 0; i < l; ++i)
+		    ga_append(&b->bv_ga, s[i]);
 	}
     }
     return 1;
--- a/src/version.c
+++ b/src/version.c
@@ -776,6 +776,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1054,
+/**/
     1053,
 /**/
     1052,