Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.757
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.757
Problem:    Issue 96: May access freed memory when a put command triggers
	    autocommands. (Dominique Pelle)
Solution:   Call u_save() before getting y_array.
Files:	    src/ops.c


*** ../vim-7.3.756/src/ops.c	2012-09-05 14:18:42.000000000 +0200
--- src/ops.c	2012-12-12 16:03:35.000000000 +0100
***************
*** 3351,3356 ****
--- 3351,3362 ----
  	    return;
      }
  
+ #ifdef FEAT_AUTOCMD
+     /* Autocommands may be executed when saving lines for undo, which may make
+      * y_array invalid.  Start undo now to avoid that. */
+     u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1);
+ #endif
+ 
      if (insert_string != NULL)
      {
  	y_type = MCHAR;
*** ../vim-7.3.756/src/version.c	2012-12-12 15:55:16.000000000 +0100
--- src/version.c	2012-12-12 16:06:47.000000000 +0100
***************
*** 727,728 ****
--- 727,730 ----
  {   /* Add new patch number below this line */
+ /**/
+     757,
  /**/

-- 
We are the Borg of GNU GPL.  We will assimilate your source code.
Resistance is futile.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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    ///