changeset 7256:79270eaac6de v7.4.936

commit https://github.com/vim/vim/commit/294a7e55b01149154807a23323038784549b8946 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 22 19:39:38 2015 +0100 patch 7.4.936 Problem: Crash when dragging with the mouse. Solution: Add safety check for NULL pointer. Check mouse position for valid value. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sun, 22 Nov 2015 19:45:05 +0100
parents c4606e322fa4
children a49ad3a505cf
files src/term.c src/version.c src/window.c
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/term.c
+++ b/src/term.c
@@ -5231,6 +5231,13 @@ check_termcode(max_offset, buf, bufsize,
 	    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 */
 
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    936,
+/**/
     935,
 /**/
     934,
--- a/src/window.c
+++ b/src/window.c
@@ -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);