To: vim_dev@googlegroups.com Subject: Patch 8.1.1054 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1054 Problem: Not checking return value of ga_grow(). (Coverity) Solution: Only append when ga_grow() returns OK. Files: src/if_lua.c *** ../vim-8.1.1053/src/if_lua.c 2019-03-23 13:56:30.189804811 +0100 --- src/if_lua.c 2019-03-26 21:40:15.851115489 +0100 *************** *** 1144,1152 **** 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]); } lua_settop(L, 1); return 1; --- 1144,1152 ---- size_t i, l = 0; const char *s = lua_tolstring(L, 2, &l); ! 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,1784 **** 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]); } } return 1; --- 1776,1784 ---- size_t i, l = 0; const char *s = lua_tolstring(L, 1, &l); ! if (ga_grow(&b->bv_ga, l) == OK) ! for (i = 0; i < l; ++i) ! ga_append(&b->bv_ga, s[i]); } } return 1; *** ../vim-8.1.1053/src/version.c 2019-03-26 00:31:17.221047734 +0100 --- src/version.c 2019-03-26 21:41:01.734718469 +0100 *************** *** 777,778 **** --- 777,780 ---- { /* Add new patch number below this line */ + /**/ + 1054, /**/ -- I'm writing a book. I've got the page numbers done. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///