Karsten Hopp cbb79a
To: vim_dev@googlegroups.com
Karsten Hopp cbb79a
Subject: Patch 7.4.936
Karsten Hopp cbb79a
Fcc: outbox
Karsten Hopp cbb79a
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp cbb79a
Mime-Version: 1.0
Karsten Hopp cbb79a
Content-Type: text/plain; charset=UTF-8
Karsten Hopp cbb79a
Content-Transfer-Encoding: 8bit
Karsten Hopp cbb79a
------------
Karsten Hopp cbb79a
Karsten Hopp cbb79a
Patch 7.4.936
Karsten Hopp cbb79a
Problem:    Crash when dragging with the mouse.
Karsten Hopp cbb79a
Solution:   Add safety check for NULL pointer. Check mouse position for valid
Karsten Hopp cbb79a
            value. (Hirohito Higashi)
Karsten Hopp cbb79a
Files:      src/window.c, src/term.c
Karsten Hopp cbb79a
Karsten Hopp cbb79a
Karsten Hopp cbb79a
*** ../vim-7.4.935/src/window.c	2015-11-19 13:14:26.031915183 +0100
Karsten Hopp cbb79a
--- src/window.c	2015-11-22 19:22:45.009237162 +0100
Karsten Hopp cbb79a
***************
Karsten Hopp cbb79a
*** 5785,5790 ****
Karsten Hopp cbb79a
--- 5785,5792 ----
Karsten Hopp cbb79a
  	offset = room;		/* Move as far as we can */
Karsten Hopp cbb79a
      if (offset <= 0)		/* No room at all, quit. */
Karsten Hopp cbb79a
  	return;
Karsten Hopp cbb79a
+     if (fr == NULL)
Karsten Hopp cbb79a
+ 	return;			/* Safety check, should not happen. */
Karsten Hopp cbb79a
  
Karsten Hopp cbb79a
      /* grow frame fr by offset lines */
Karsten Hopp cbb79a
      frame_new_width(fr, fr->fr_width + offset, left, FALSE);
Karsten Hopp cbb79a
*** ../vim-7.4.935/src/term.c	2015-11-10 15:17:59.166278487 +0100
Karsten Hopp cbb79a
--- src/term.c	2015-11-22 19:31:09.535677713 +0100
Karsten Hopp cbb79a
***************
Karsten Hopp cbb79a
*** 5231,5236 ****
Karsten Hopp cbb79a
--- 5231,5243 ----
Karsten Hopp cbb79a
  	    else
Karsten Hopp cbb79a
  		key_name[1] = get_pseudo_mouse_code(current_button,
Karsten Hopp cbb79a
  							   is_click, is_drag);
Karsten Hopp cbb79a
+ 
Karsten Hopp cbb79a
+ 	    /* Make sure the mouse position is valid.  Some terminals may
Karsten Hopp cbb79a
+ 	     * return weird values. */
Karsten Hopp cbb79a
+ 	    if (mouse_col >= Columns)
Karsten Hopp cbb79a
+ 		mouse_col = Columns - 1;
Karsten Hopp cbb79a
+ 	    if (mouse_row >= Rows)
Karsten Hopp cbb79a
+ 		mouse_row = Rows - 1;
Karsten Hopp cbb79a
  	}
Karsten Hopp cbb79a
  #endif /* FEAT_MOUSE */
Karsten Hopp cbb79a
  
Karsten Hopp cbb79a
*** ../vim-7.4.935/src/version.c	2015-11-22 15:08:17.475927509 +0100
Karsten Hopp cbb79a
--- src/version.c	2015-11-22 19:35:43.728648086 +0100
Karsten Hopp cbb79a
***************
Karsten Hopp cbb79a
*** 743,744 ****
Karsten Hopp cbb79a
--- 743,746 ----
Karsten Hopp cbb79a
  {   /* Add new patch number below this line */
Karsten Hopp cbb79a
+ /**/
Karsten Hopp cbb79a
+     936,
Karsten Hopp cbb79a
  /**/
Karsten Hopp cbb79a
Karsten Hopp cbb79a
-- 
Karsten Hopp cbb79a
A: Because it messes up the order in which people normally read text.
Karsten Hopp cbb79a
Q: Why is top-posting such a bad thing?
Karsten Hopp cbb79a
A: Top-posting.
Karsten Hopp cbb79a
Q: What is the most annoying thing on usenet and in e-mail?
Karsten Hopp cbb79a
Karsten Hopp cbb79a
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp cbb79a
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp cbb79a
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp cbb79a
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///