Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.330
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.330
Problem:    Reading uninitialized memory when using Del in replace mode.
Solution:   Use utfc_ptr2len_len() instead of mb_ptr2len(). (Dominique Pelle)
Files:	    src/misc1.c


*** ../vim-7.1.329/src/misc1.c	Mon Feb 25 21:54:23 2008
--- src/misc1.c	Sat Jun 21 16:02:34 2008
***************
*** 1880,1894 ****
  # ifdef FEAT_MBYTE
      int		n;
  
!     for (i = 0; i < len; i += n)
!     {
! 	n = (*mb_ptr2len)(p + i);
! 	ins_char_bytes(p + i, n);
!     }
! # else
!     for (i = 0; i < len; ++i)
! 	ins_char(p[i]);
  # endif
  }
  #endif
  
--- 1880,1899 ----
  # ifdef FEAT_MBYTE
      int		n;
  
!     if (has_mbyte)
! 	for (i = 0; i < len; i += n)
! 	{
! 	    if (enc_utf8)
! 		/* avoid reading past p[len] */
! 		n = utfc_ptr2len_len(p + i, len - i);
! 	    else
! 		n = (*mb_ptr2len)(p + i);
! 	    ins_char_bytes(p + i, n);
! 	}
!     else
  # endif
+ 	for (i = 0; i < len; ++i)
+ 	    ins_char(p[i]);
  }
  #endif
  
*** ../vim-7.1.329/src/version.c	Sat Jun 21 14:13:51 2008
--- src/version.c	Sat Jun 21 16:28:28 2008
***************
*** 668,669 ****
--- 673,676 ----
  {   /* Add new patch number below this line */
+ /**/
+     330,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
65. The last time you looked at the clock it was 11:30pm, and in what
    seems like only a few seconds later, your sister runs past you to
    catch her 7am school bus.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///