patch 8.0.0891: uninitialized memory use with empty line in terminal v8.0.0891
authorBram Moolenaar <Bram@vim.org>
Mon, 7 Aug 2017 20:08:05 +0000 (22:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Aug 2017 20:08:05 +0000 (22:08 +0200)
Problem:    Uninitialized memory use with empty line in terminal.
Solution:   Initialize growarray earlier. (Yasuhiro Matsumoto, closes #1949)

src/terminal.c
src/version.c

index 7029f49abcf0c4f98f5c4420f1cc3a687988aa9d..9743468f28c0e6957327bfa11be4bda76dd9a05d 100644 (file)
@@ -1346,11 +1346,11 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
            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)
index 0873d25e97fc505e8bb0b8162d55612c2a53b6a9..6b33c3bb669cc731ff9345dd37a087f13595683e 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    891,
 /**/
     890,
 /**/