Skip to content

Commit 7fadbf8

Browse files
committed
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)
1 parent 75373f3 commit 7fadbf8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/terminal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,11 +1346,11 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
13461346
if (cells[i].chars[0] != 0)
13471347
len = i + 1;
13481348

1349+
ga_init2(&ga, 1, 100);
13491350
if (len > 0)
13501351
p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len);
13511352
if (p != NULL)
13521353
{
1353-
ga_init2(&ga, 1, 100);
13541354
for (col = 0; col < len; col += cells[col].width)
13551355
{
13561356
if (ga_grow(&ga, MB_MAXBYTES) == FAIL)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
891,
772774
/**/
773775
890,
774776
/**/

0 commit comments

Comments
 (0)