home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.521 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  3.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.521
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.521
  11. Problem:    Using "z=" on a multi-byte character may cause a crash.
  12. Solution:   Don't use strlen() on an int pointer.
  13. Files:        src/spell.c
  14.  
  15.  
  16. *** ../vim-7.3.520/src/spell.c    2012-01-10 22:26:12.000000000 +0100
  17. --- src/spell.c    2012-05-18 18:01:58.000000000 +0200
  18. ***************
  19. *** 14494,14506 ****
  20.       int        p0 = -333;
  21.       int        c0;
  22.       int        did_white = FALSE;
  23.   
  24.       /*
  25.        * Convert the multi-byte string to a wide-character string.
  26.        * Remove accents, if wanted.  We actually remove all non-word characters.
  27.        * But keep white space.
  28.        */
  29. !     n = 0;
  30.       for (s = inword; *s != NUL; )
  31.       {
  32.       t = s;
  33. --- 14494,14508 ----
  34.       int        p0 = -333;
  35.       int        c0;
  36.       int        did_white = FALSE;
  37. +     int        wordlen;
  38.   
  39.       /*
  40.        * Convert the multi-byte string to a wide-character string.
  41.        * Remove accents, if wanted.  We actually remove all non-word characters.
  42.        * But keep white space.
  43.        */
  44. !     wordlen = 0;
  45.       for (s = inword; *s != NUL; )
  46.       {
  47.       t = s;
  48. ***************
  49. *** 14521,14532 ****
  50.               continue;
  51.           }
  52.       }
  53. !     word[n++] = c;
  54.       }
  55. !     word[n] = NUL;
  56.   
  57.       /*
  58. !      * This comes from Aspell phonet.cpp.
  59.        * Converted from C++ to C.  Added support for multi-byte chars.
  60.        * Changed to keep spaces.
  61.        */
  62. --- 14523,14534 ----
  63.               continue;
  64.           }
  65.       }
  66. !     word[wordlen++] = c;
  67.       }
  68. !     word[wordlen] = NUL;
  69.   
  70.       /*
  71. !      * This algorithm comes from Aspell phonet.cpp.
  72.        * Converted from C++ to C.  Added support for multi-byte chars.
  73.        * Changed to keep spaces.
  74.        */
  75. ***************
  76. *** 14711,14717 ****
  77.                   }
  78.               if (k > k0)
  79.                   mch_memmove(word + i + k0, word + i + k,
  80. !                     sizeof(int) * (STRLEN(word + i + k) + 1));
  81.   
  82.               /* new "actual letter" */
  83.               c = word[i];
  84. --- 14713,14719 ----
  85.                   }
  86.               if (k > k0)
  87.                   mch_memmove(word + i + k0, word + i + k,
  88. !                     sizeof(int) * (wordlen - (i + k) + 1));
  89.   
  90.               /* new "actual letter" */
  91.               c = word[i];
  92. ***************
  93. *** 14739,14745 ****
  94.                   if (c != NUL)
  95.                   wres[reslen++] = c;
  96.                   mch_memmove(word, word + i + 1,
  97. !                     sizeof(int) * (STRLEN(word + i + 1) + 1));
  98.                   i = 0;
  99.                   z0 = 1;
  100.               }
  101. --- 14741,14747 ----
  102.                   if (c != NUL)
  103.                   wres[reslen++] = c;
  104.                   mch_memmove(word, word + i + 1,
  105. !                        sizeof(int) * (wordlen - (i + 1) + 1));
  106.                   i = 0;
  107.                   z0 = 1;
  108.               }
  109. *** ../vim-7.3.520/src/version.c    2012-05-18 17:03:14.000000000 +0200
  110. --- src/version.c    2012-05-18 18:06:29.000000000 +0200
  111. ***************
  112. *** 716,717 ****
  113. --- 716,719 ----
  114.   {   /* Add new patch number below this line */
  115. + /**/
  116. +     521,
  117.   /**/
  118.  
  119. -- 
  120. OLD WOMAN: King of the WHO?
  121. ARTHUR:    The Britons.
  122. OLD WOMAN: Who are the Britons?
  123.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  124.  
  125.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  126. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  127. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  128.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  129.