comparison src/terminal.c @ 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 e30f3d1fdea7
children 0197e3f52192
comparison
equal deleted inserted replaced
12020:7aa74e610704 12021:a7457aed7e80
1344 /* do not store empty cells at the end */ 1344 /* do not store empty cells at the end */
1345 for (i = 0; i < cols; ++i) 1345 for (i = 0; i < cols; ++i)
1346 if (cells[i].chars[0] != 0) 1346 if (cells[i].chars[0] != 0)
1347 len = i + 1; 1347 len = i + 1;
1348 1348
1349 ga_init2(&ga, 1, 100);
1349 if (len > 0) 1350 if (len > 0)
1350 p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len); 1351 p = (cellattr_T *)alloc((int)sizeof(cellattr_T) * len);
1351 if (p != NULL) 1352 if (p != NULL)
1352 { 1353 {
1353 ga_init2(&ga, 1, 100);
1354 for (col = 0; col < len; col += cells[col].width) 1354 for (col = 0; col < len; col += cells[col].width)
1355 { 1355 {
1356 if (ga_grow(&ga, MB_MAXBYTES) == FAIL) 1356 if (ga_grow(&ga, MB_MAXBYTES) == FAIL)
1357 { 1357 {
1358 ga.ga_len = 0; 1358 ga.ga_len = 0;