]> granicus.if.org Git - vim/commitdiff
patch 7.4.936 v7.4.936
authorBram Moolenaar <Bram@vim.org>
Sun, 22 Nov 2015 18:39:38 +0000 (19:39 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 22 Nov 2015 18:39:38 +0000 (19:39 +0100)
Problem:    Crash when dragging with the mouse.
Solution:   Add safety check for NULL pointer. Check mouse position for valid
            value. (Hirohito Higashi)

src/term.c
src/version.c
src/window.c

index 51698fb993c779531c7f72b47b86ee9919c65fe2..226bdee512d86cc8ebf9faf63c52cc14c07acf5a 100644 (file)
@@ -5231,6 +5231,13 @@ check_termcode(max_offset, buf, bufsize, buflen)
            else
                key_name[1] = get_pseudo_mouse_code(current_button,
                                                           is_click, is_drag);
+
+           /* Make sure the mouse position is valid.  Some terminals may
+            * return weird values. */
+           if (mouse_col >= Columns)
+               mouse_col = Columns - 1;
+           if (mouse_row >= Rows)
+               mouse_row = Rows - 1;
        }
 #endif /* FEAT_MOUSE */
 
index dafc3913d4508a9dcfdfb674b2663a6e841fbf3f..9f0cfbf6a34836c86ea50a3aa5beb8dffdfe5713 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    936,
 /**/
     935,
 /**/
index e8134e06a21ded9ae2c3edffd6fe177f9b1788e3..010d7ae50aef8776df674a25e4d78252892e16e6 100644 (file)
@@ -5785,6 +5785,8 @@ win_drag_vsep_line(dragwin, offset)
        offset = room;          /* Move as far as we can */
     if (offset <= 0)           /* No room at all, quit. */
        return;
+    if (fr == NULL)
+       return;                 /* Safety check, should not happen. */
 
     /* grow frame fr by offset lines */
     frame_new_width(fr, fr->fr_width + offset, left, FALSE);