1
0
forked from aniani/vim

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 #1949)
This commit is contained in:
Bram Moolenaar
2017-08-07 22:08:05 +02:00
parent 75373f3808
commit 7fadbf8325
2 changed files with 3 additions and 1 deletions

View File

@@ -1346,11 +1346,11 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
if (cells[i].chars[0] != 0) if (cells[i].chars[0] != 0)
len = i + 1; len = i + 1;
ga_init2(&ga, 1, 100);
if (len > 0) if (len > 0)
p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len);
if (p != NULL) if (p != NULL)
{ {
ga_init2(&ga, 1, 100);
for (col = 0; col < len; col += cells[col].width) for (col = 0; col < len; col += cells[col].width)
{ {
if (ga_grow(&ga, MB_MAXBYTES) == FAIL) if (ga_grow(&ga, MB_MAXBYTES) == FAIL)

View File

@@ -769,6 +769,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 */
/**/
891,
/**/ /**/
890, 890,
/**/ /**/