Patch 7.2a.006
Problem:    Reading past NUL in a string.
Solution:   Check for invalid utf-8 byte sequence. (Dominique Pelle)
Files:      src/charset.c


*** ../vim-7.2a.005/src/charset.c       Tue Jun 24 23:25:31 2008
--- src/charset.c       Sat Jun 28 12:35:01 2008
***************
*** 449,461 ****
        {
            if (enc_utf8)
            {
!               int     c, lc;
! 
!               c = utf_ptr2char(STR_PTR(i));
!               lc = utf_tolower(c);
!               if (c != lc)
                {
-                   int     ol = utf_char2len(c);
                    int     nl = utf_char2len(lc);
  
                    /* If the byte length changes need to shift the following
--- 449,463 ----
        {
            if (enc_utf8)
            {
!               int     c = utf_ptr2char(STR_PTR(i));
!               int     ol = utf_ptr2len(STR_PTR(i));
!               int     lc = utf_tolower(c);
! 
!               /* Only replace the character when it is not an invalid
!                * sequence (ASCII character or more than one byte) and
!                * utf_tolower() doesn't return the original character. */
!               if ((c < 0x80 || ol > 1) && c != lc)
                {
                    int     nl = utf_char2len(lc);
  
                    /* If the byte length changes need to shift the following
*** ../vim-7.2a.005/src/version.c       Fri Jun 27 21:16:33 2008
--- src/version.c       Sat Jun 28 12:48:02 2008
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     6,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
109. You actually read -- and enjoy -- lists like this.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui