patch 9.0.1916: Crash when allocating large terminal screen

Problem:  Crash when allocating large terminal screen
Solution: Don't allow values > 1000 for terminal
          screen columns and rows

closes: #13126

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2023-09-19 21:05:20 +02:00
parent 476733f3d0
commit aa64ba1587
5 changed files with 40 additions and 1 deletions

View File

@ -776,9 +776,15 @@ static int resize(int new_rows, int new_cols, VTermStateFields *fields, void *us
if(screen->sb_buffer)
vterm_allocator_free(screen->vt, screen->sb_buffer);
if (new_cols > 1000)
new_cols = 1000;
screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols);
}
if (new_rows > 1000)
new_rows = 1000;
resize_buffer(screen, 0, new_rows, new_cols, !altscreen_active, fields);
if(screen->buffers[BUFIDX_ALTSCREEN])
resize_buffer(screen, 1, new_rows, new_cols, altscreen_active, fields);