forked from aniani/vim
patch 8.2.0989: crash after resizing a terminal window
Problem: Crash after resizing a terminal window. (August Masquelier) Solution: Add check for valid row in libvterm. (closes #6273)
This commit is contained in:
@@ -280,6 +280,12 @@ static int erase_internal(VTermRect rect, int selective, void *user)
|
|||||||
for(col = rect.start_col; col < rect.end_col; col++) {
|
for(col = rect.start_col; col < rect.end_col; col++) {
|
||||||
ScreenCell *cell = getcell(screen, row, col);
|
ScreenCell *cell = getcell(screen, row, col);
|
||||||
|
|
||||||
|
if (cell == NULL)
|
||||||
|
{
|
||||||
|
DEBUG_LOG2("libvterm: erase_internal() position invalid: %d / %d",
|
||||||
|
row, col);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if(selective && cell->pen.protected_cell)
|
if(selective && cell->pen.protected_cell)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -16,6 +16,12 @@ static int on_resize(int rows, int cols, void *user);
|
|||||||
static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos)
|
static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos)
|
||||||
{
|
{
|
||||||
VTermGlyphInfo info;
|
VTermGlyphInfo info;
|
||||||
|
|
||||||
|
if (pos.row >= state->rows)
|
||||||
|
{
|
||||||
|
DEBUG_LOG2("libvterm: putglyph() pos.row %d out of range (rows = %d)\n", pos.row, state.rows);
|
||||||
|
return;
|
||||||
|
}
|
||||||
info.chars = chars;
|
info.chars = chars;
|
||||||
info.width = width;
|
info.width = width;
|
||||||
info.protected_cell = state->protected_cell;
|
info.protected_cell = state->protected_cell;
|
||||||
@@ -283,6 +289,11 @@ static int on_text(const char bytes[], size_t len, void *user)
|
|||||||
|
|
||||||
VTermPos oldpos = state->pos;
|
VTermPos oldpos = state->pos;
|
||||||
|
|
||||||
|
if (state->pos.row >= state->rows)
|
||||||
|
{
|
||||||
|
DEBUG_LOG2("libvterm: on_text() pos.row %d out of range (rows = %d)\n", state->pos.row, state.rows);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// We'll have at most len codepoints, plus one from a previous incomplete
|
// We'll have at most len codepoints, plus one from a previous incomplete
|
||||||
// sequence.
|
// sequence.
|
||||||
codepoints = vterm_allocator_malloc(state->vt, (len + 1) * sizeof(uint32_t));
|
codepoints = vterm_allocator_malloc(state->vt, (len + 1) * sizeof(uint32_t));
|
||||||
|
@@ -754,6 +754,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 */
|
||||||
|
/**/
|
||||||
|
989,
|
||||||
/**/
|
/**/
|
||||||
988,
|
988,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user