Patch 8.2.0989
Problem:    Crash after resizing a terminal window. (August Masquelier)
Solution:   Add check for valid row in libvterm. (closes #6273)
Files:      src/libvterm/src/state.c, src/libvterm/src/screen.c


*** ../vim-8.2.0988/src/libvterm/src/state.c    2020-05-22 22:06:02.165271263 
+0200
--- src/libvterm/src/state.c    2020-06-16 20:44:19.541025265 +0200
***************
*** 16,21 ****
--- 16,27 ----
  static void putglyph(VTermState *state, const uint32_t chars[], int width, 
VTermPos pos)
  {
    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.width = width;
    info.protected_cell = state->protected_cell;
***************
*** 283,288 ****
--- 289,299 ----
  
    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
    // sequence.
    codepoints = vterm_allocator_malloc(state->vt, (len + 1) * 
sizeof(uint32_t));
*** ../vim-8.2.0988/src/libvterm/src/screen.c   2020-05-22 22:06:02.165271263 
+0200
--- src/libvterm/src/screen.c   2020-06-16 20:56:39.897663400 +0200
***************
*** 280,285 ****
--- 280,291 ----
      for(col = rect.start_col; col < rect.end_col; 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)
          continue;
  
*** ../vim-8.2.0988/src/version.c       2020-06-16 20:03:38.747351038 +0200
--- src/version.c       2020-06-16 20:57:49.173311712 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     989,
  /**/

-- 
ARTHUR:        A scratch?  Your arm's off!
BLACK KNIGHT:  No, it isn't.
ARTHUR:        Well, what's that then?
BLACK KNIGHT:  I've had worse.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202006161858.05GIwnSj1422120%40masaka.moolenaar.net.

Raspunde prin e-mail lui