]>
Commit | Line | Data |
---|---|---|
8bb52fd3 ER |
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 | /* | |
41 | * Convert the multi-byte string to a wide-character string. | |
42 | * Remove accents, if wanted. We actually remove all non-word characters. | |
43 | * But keep white space. | |
44 | */ | |
45 | ! wordlen = 0; | |
46 | for (s = inword; *s != NUL; ) | |
47 | { | |
48 | t = s; | |
49 | *************** | |
50 | *** 14521,14532 **** | |
51 | continue; | |
52 | } | |
53 | } | |
54 | ! word[n++] = c; | |
55 | } | |
56 | ! word[n] = NUL; | |
57 | ||
58 | /* | |
59 | ! * This comes from Aspell phonet.cpp. | |
60 | * Converted from C++ to C. Added support for multi-byte chars. | |
61 | * Changed to keep spaces. | |
62 | */ | |
63 | --- 14523,14534 ---- | |
64 | continue; | |
65 | } | |
66 | } | |
67 | ! word[wordlen++] = c; | |
68 | } | |
69 | ! word[wordlen] = NUL; | |
70 | ||
71 | /* | |
72 | ! * This algorithm comes from Aspell phonet.cpp. | |
73 | * Converted from C++ to C. Added support for multi-byte chars. | |
74 | * Changed to keep spaces. | |
75 | */ | |
76 | *************** | |
77 | *** 14711,14717 **** | |
78 | } | |
79 | if (k > k0) | |
80 | mch_memmove(word + i + k0, word + i + k, | |
81 | ! sizeof(int) * (STRLEN(word + i + k) + 1)); | |
82 | ||
83 | /* new "actual letter" */ | |
84 | c = word[i]; | |
85 | --- 14713,14719 ---- | |
86 | } | |
87 | if (k > k0) | |
88 | mch_memmove(word + i + k0, word + i + k, | |
89 | ! sizeof(int) * (wordlen - (i + k) + 1)); | |
90 | ||
91 | /* new "actual letter" */ | |
92 | c = word[i]; | |
93 | *************** | |
94 | *** 14739,14745 **** | |
95 | if (c != NUL) | |
96 | wres[reslen++] = c; | |
97 | mch_memmove(word, word + i + 1, | |
98 | ! sizeof(int) * (STRLEN(word + i + 1) + 1)); | |
99 | i = 0; | |
100 | z0 = 1; | |
101 | } | |
102 | --- 14741,14747 ---- | |
103 | if (c != NUL) | |
104 | wres[reslen++] = c; | |
105 | mch_memmove(word, word + i + 1, | |
106 | ! sizeof(int) * (wordlen - (i + 1) + 1)); | |
107 | i = 0; | |
108 | z0 = 1; | |
109 | } | |
110 | *** ../vim-7.3.520/src/version.c 2012-05-18 17:03:14.000000000 +0200 | |
111 | --- src/version.c 2012-05-18 18:06:29.000000000 +0200 | |
112 | *************** | |
113 | *** 716,717 **** | |
114 | --- 716,719 ---- | |
115 | { /* Add new patch number below this line */ | |
116 | + /**/ | |
117 | + 521, | |
118 | /**/ | |
119 | ||
120 | -- | |
121 | OLD WOMAN: King of the WHO? | |
122 | ARTHUR: The Britons. | |
123 | OLD WOMAN: Who are the Britons? | |
124 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
125 | ||
126 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
127 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
128 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
129 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |