changeset 12021:a7457aed7e80 v8.0.0891

patch 8.0.0891: uninitialized memory use with empty line in terminal commit https://github.com/vim/vim/commit/7fadbf83256bb823b994a52758127594dd82ab39 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 7 22:08:05 2017 +0200 patch 8.0.0891: uninitialized memory use with empty line in terminal Problem: Uninitialized memory use with empty line in terminal. Solution: Initialize growarray earlier. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/1949)
author Christian Brabandt <cb@256bit.org>
date Mon, 07 Aug 2017 22:15:04 +0200
parents 7aa74e610704
children 79faee34368c
files src/terminal.c src/version.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1346,11 +1346,11 @@ handle_pushline(int cols, const VTermScr
 	    if (cells[i].chars[0] != 0)
 		len = i + 1;
 
+	ga_init2(&ga, 1, 100);
 	if (len > 0)
 	    p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len);
 	if (p != NULL)
 	{
-	    ga_init2(&ga, 1, 100);
 	    for (col = 0; col < len; col += cells[col].width)
 	    {
 		if (ga_grow(&ga, MB_MAXBYTES) == FAIL)
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    891,
+/**/
     890,
 /**/
     889,