Karsten Hopp 112186
To: vim-dev@vim.org
Karsten Hopp 112186
Subject: Patch 7.2.297
Karsten Hopp 112186
Fcc: outbox
Karsten Hopp 112186
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 112186
Mime-Version: 1.0
Karsten Hopp 112186
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 112186
Content-Transfer-Encoding: 8bit
Karsten Hopp 112186
------------
Karsten Hopp 112186
Karsten Hopp 112186
Patch 7.2.297
Karsten Hopp 112186
Problem:    Reading freed memory when writing ":reg" output to a register.
Karsten Hopp 112186
	    (Dominique Pelle)
Karsten Hopp 112186
Solution:   Skip the register being written to.
Karsten Hopp 112186
Files:	    src/ops.c
Karsten Hopp 112186
Karsten Hopp 112186
Karsten Hopp 112186
*** ../vim-7.2.296/src/ops.c	2009-11-11 17:22:30.000000000 +0100
Karsten Hopp 112186
--- src/ops.c	2009-11-11 19:30:47.000000000 +0100
Karsten Hopp 112186
***************
Karsten Hopp 112186
*** 3991,3996 ****
Karsten Hopp 112186
--- 3991,4004 ----
Karsten Hopp 112186
  	}
Karsten Hopp 112186
  	else
Karsten Hopp 112186
  	    yb = &(y_regs[i]);
Karsten Hopp 112186
+ 
Karsten Hopp 112186
+ #ifdef FEAT_EVAL
Karsten Hopp 112186
+ 	if (name == MB_TOLOWER(redir_reg)
Karsten Hopp 112186
+ 		|| (redir_reg == '"' && yb == y_previous))
Karsten Hopp 112186
+ 	    continue;	    /* do not list register being written to, the
Karsten Hopp 112186
+ 			     * pointer can be freed */
Karsten Hopp 112186
+ #endif
Karsten Hopp 112186
+ 
Karsten Hopp 112186
  	if (yb->y_array != NULL)
Karsten Hopp 112186
  	{
Karsten Hopp 112186
  	    msg_putchar('\n');
Karsten Hopp 112186
***************
Karsten Hopp 112186
*** 6090,6096 ****
Karsten Hopp 112186
      long	maxlen;
Karsten Hopp 112186
  #endif
Karsten Hopp 112186
  
Karsten Hopp 112186
!     if (y_ptr->y_array == NULL)		/* NULL means emtpy register */
Karsten Hopp 112186
  	y_ptr->y_size = 0;
Karsten Hopp 112186
  
Karsten Hopp 112186
      /*
Karsten Hopp 112186
--- 6098,6104 ----
Karsten Hopp 112186
      long	maxlen;
Karsten Hopp 112186
  #endif
Karsten Hopp 112186
  
Karsten Hopp 112186
!     if (y_ptr->y_array == NULL)		/* NULL means empty register */
Karsten Hopp 112186
  	y_ptr->y_size = 0;
Karsten Hopp 112186
  
Karsten Hopp 112186
      /*
Karsten Hopp 112186
*** ../vim-7.2.296/src/version.c	2009-11-17 12:31:30.000000000 +0100
Karsten Hopp 112186
--- src/version.c	2009-11-17 12:42:28.000000000 +0100
Karsten Hopp 112186
***************
Karsten Hopp 112186
*** 683,684 ****
Karsten Hopp 112186
--- 683,686 ----
Karsten Hopp 112186
  {   /* Add new patch number below this line */
Karsten Hopp 112186
+ /**/
Karsten Hopp 112186
+     297,
Karsten Hopp 112186
  /**/
Karsten Hopp 112186
Karsten Hopp 112186
-- 
Karsten Hopp 112186
"Beware of bugs in the above code; I have only proved
Karsten Hopp 112186
it correct, not tried it." -- Donald Knuth
Karsten Hopp 112186
Karsten Hopp 112186
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 112186
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 112186
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 112186
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///