|
1 To: [email protected] |
|
2 Subject: Patch 7.2.439 |
|
3 Fcc: outbox |
|
4 From: Bram Moolenaar <[email protected]> |
|
5 Mime-Version: 1.0 |
|
6 Content-Type: text/plain; charset=UTF-8 |
|
7 Content-Transfer-Encoding: 8bit |
|
8 ------------ |
|
9 |
|
10 Patch 7.2.439 |
|
11 Problem: Invalid memory access when doing thesaurus completion and |
|
12 'infercase' is set. |
|
13 Solution: Use the minimal length of completed word and replacement. |
|
14 (Dominique Pelle) |
|
15 Files: src/edit.c |
|
16 |
|
17 |
|
18 *** ../vim-7.2.438/src/edit.c 2010-03-10 14:15:28.000000000 +0100 |
|
19 --- src/edit.c 2010-05-28 21:20:29.000000000 +0200 |
|
20 *************** |
|
21 *** 2164,2169 **** |
|
22 --- 2164,2170 ---- |
|
23 int i, c; |
|
24 int actual_len; /* Take multi-byte characters */ |
|
25 int actual_compl_length; /* into account. */ |
|
26 + int min_len; |
|
27 int *wca; /* Wide character array. */ |
|
28 int has_lower = FALSE; |
|
29 int was_letter = FALSE; |
|
30 *************** |
|
31 *** 2204,2209 **** |
|
32 --- 2205,2215 ---- |
|
33 #endif |
|
34 actual_compl_length = compl_length; |
|
35 |
|
36 + /* "actual_len" may be smaller than "actual_compl_length" when using |
|
37 + * thesaurus, only use the minimum when comparing. */ |
|
38 + min_len = actual_len < actual_compl_length |
|
39 + ? actual_len : actual_compl_length; |
|
40 + |
|
41 /* Allocate wide character array for the completion and fill it. */ |
|
42 wca = (int *)alloc((unsigned)(actual_len * sizeof(int))); |
|
43 if (wca != NULL) |
|
44 *************** |
|
45 *** 2219,2225 **** |
|
46 |
|
47 /* Rule 1: Were any chars converted to lower? */ |
|
48 p = compl_orig_text; |
|
49 ! for (i = 0; i < actual_compl_length; ++i) |
|
50 { |
|
51 #ifdef FEAT_MBYTE |
|
52 if (has_mbyte) |
|
53 --- 2225,2231 ---- |
|
54 |
|
55 /* Rule 1: Were any chars converted to lower? */ |
|
56 p = compl_orig_text; |
|
57 ! for (i = 0; i < min_len; ++i) |
|
58 { |
|
59 #ifdef FEAT_MBYTE |
|
60 if (has_mbyte) |
|
61 *************** |
|
62 *** 2247,2253 **** |
|
63 if (!has_lower) |
|
64 { |
|
65 p = compl_orig_text; |
|
66 ! for (i = 0; i < actual_compl_length; ++i) |
|
67 { |
|
68 #ifdef FEAT_MBYTE |
|
69 if (has_mbyte) |
|
70 --- 2253,2259 ---- |
|
71 if (!has_lower) |
|
72 { |
|
73 p = compl_orig_text; |
|
74 ! for (i = 0; i < min_len; ++i) |
|
75 { |
|
76 #ifdef FEAT_MBYTE |
|
77 if (has_mbyte) |
|
78 *************** |
|
79 *** 2268,2274 **** |
|
80 |
|
81 /* Copy the original case of the part we typed. */ |
|
82 p = compl_orig_text; |
|
83 ! for (i = 0; i < actual_compl_length; ++i) |
|
84 { |
|
85 #ifdef FEAT_MBYTE |
|
86 if (has_mbyte) |
|
87 --- 2274,2280 ---- |
|
88 |
|
89 /* Copy the original case of the part we typed. */ |
|
90 p = compl_orig_text; |
|
91 ! for (i = 0; i < min_len; ++i) |
|
92 { |
|
93 #ifdef FEAT_MBYTE |
|
94 if (has_mbyte) |
|
95 *** ../vim-7.2.438/src/version.c 2010-05-25 21:37:12.000000000 +0200 |
|
96 --- src/version.c 2010-05-28 21:30:53.000000000 +0200 |
|
97 *************** |
|
98 *** 683,684 **** |
|
99 --- 683,686 ---- |
|
100 { /* Add new patch number below this line */ |
|
101 + /**/ |
|
102 + 439, |
|
103 /**/ |
|
104 |
|
105 -- |
|
106 Corduroy pillows: They're making headlines! |
|
107 |
|
108 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ |
|
109 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
|
110 \\\ download, build and distribute -- http://www.A-A-P.org /// |
|
111 \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |