]> git.ipfire.org Git - ipfire-3.x.git/blob - vim/patches/vim-7.3.109.patch0
python3: Update to 3.6.3
[ipfire-3.x.git] / vim / patches / vim-7.3.109.patch0
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.109
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.109
11 Problem: Processing new Esperanto spell file fails and crashes Vim.
12 (Dominique Pelle)
13 Solution: When running out of memory give an error. Handle '?' in
14 COMPOUNDRULE properly.
15 Files: src/spell.c
16
17
18 *** ../vim-7.3.108/src/spell.c 2010-12-17 18:06:00.000000000 +0100
19 --- src/spell.c 2011-02-01 13:43:52.000000000 +0100
20 ***************
21 *** 3634,3640 ****
22 }
23
24 /* Add all flags to "sl_compallflags". */
25 ! if (vim_strchr((char_u *)"+*[]/", c) == NULL
26 && !byte_in_str(slang->sl_compallflags, c))
27 {
28 *ap++ = c;
29 --- 3634,3640 ----
30 }
31
32 /* Add all flags to "sl_compallflags". */
33 ! if (vim_strchr((char_u *)"?*+[]/", c) == NULL
34 && !byte_in_str(slang->sl_compallflags, c))
35 {
36 *ap++ = c;
37 ***************
38 *** 3664,3670 ****
39 /* Copy flag to "sl_comprules", unless we run into a wildcard. */
40 if (crp != NULL)
41 {
42 ! if (c == '+' || c == '*')
43 {
44 vim_free(slang->sl_comprules);
45 slang->sl_comprules = NULL;
46 --- 3664,3670 ----
47 /* Copy flag to "sl_comprules", unless we run into a wildcard. */
48 if (crp != NULL)
49 {
50 ! if (c == '?' || c == '+' || c == '*')
51 {
52 vim_free(slang->sl_comprules);
53 slang->sl_comprules = NULL;
54 ***************
55 *** 3682,3689 ****
56 }
57 else /* normal char, "[abc]" and '*' are copied as-is */
58 {
59 ! if (c == '+' || c == '~')
60 ! *pp++ = '\\'; /* "a+" becomes "a\+" */
61 #ifdef FEAT_MBYTE
62 if (enc_utf8)
63 pp += mb_char2bytes(c, pp);
64 --- 3682,3689 ----
65 }
66 else /* normal char, "[abc]" and '*' are copied as-is */
67 {
68 ! if (c == '?' || c == '+' || c == '~')
69 ! *pp++ = '\\'; /* "a?" becomes "a\?", "a+" becomes "a\+" */
70 #ifdef FEAT_MBYTE
71 if (enc_utf8)
72 pp += mb_char2bytes(c, pp);
73 ***************
74 *** 4951,4956 ****
75 --- 4951,4958 ----
76
77 sblock_T *si_blocks; /* memory blocks used */
78 long si_blocks_cnt; /* memory blocks allocated */
79 + int si_did_emsg; /* TRUE when ran out of memory */
80 +
81 long si_compress_cnt; /* words to add before lowering
82 compression limit */
83 wordnode_T *si_first_free; /* List of nodes that have been freed during
84 ***************
85 *** 5477,5497 ****
86 }
87 else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
88 {
89 ! /* Concatenate this string to previously defined ones, using a
90 ! * slash to separate them. */
91 ! l = (int)STRLEN(items[1]) + 1;
92 ! if (compflags != NULL)
93 ! l += (int)STRLEN(compflags) + 1;
94 ! p = getroom(spin, l, FALSE);
95 ! if (p != NULL)
96 {
97 if (compflags != NULL)
98 {
99 ! STRCPY(p, compflags);
100 ! STRCAT(p, "/");
101 }
102 - STRCAT(p, items[1]);
103 - compflags = p;
104 }
105 }
106 else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
107 --- 5479,5503 ----
108 }
109 else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
110 {
111 ! /* Don't use the first rule if it is a number. */
112 ! if (compflags != NULL || *skipdigits(items[1]) != NUL)
113 {
114 + /* Concatenate this string to previously defined ones,
115 + * using a slash to separate them. */
116 + l = (int)STRLEN(items[1]) + 1;
117 if (compflags != NULL)
118 + l += (int)STRLEN(compflags) + 1;
119 + p = getroom(spin, l, FALSE);
120 + if (p != NULL)
121 {
122 ! if (compflags != NULL)
123 ! {
124 ! STRCPY(p, compflags);
125 ! STRCAT(p, "/");
126 ! }
127 ! STRCAT(p, items[1]);
128 ! compflags = p;
129 }
130 }
131 }
132 else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
133 ***************
134 *** 6291,6297 ****
135
136 for (p = compflags; *p != NUL; )
137 {
138 ! if (vim_strchr((char_u *)"/*+[]", *p) != NULL)
139 /* Copy non-flag characters directly. */
140 *tp++ = *p++;
141 else
142 --- 6297,6303 ----
143
144 for (p = compflags; *p != NUL; )
145 {
146 ! if (vim_strchr((char_u *)"/?*+[]", *p) != NULL)
147 /* Copy non-flag characters directly. */
148 *tp++ = *p++;
149 else
150 ***************
151 *** 6320,6326 ****
152 {
153 check_renumber(spin);
154 id = spin->si_newcompID--;
155 ! } while (vim_strchr((char_u *)"/+*[]\\-^", id) != NULL);
156 ci->ci_newID = id;
157 hash_add(&aff->af_comp, ci->ci_key);
158 }
159 --- 6326,6332 ----
160 {
161 check_renumber(spin);
162 id = spin->si_newcompID--;
163 ! } while (vim_strchr((char_u *)"/?*+[]\\-^", id) != NULL);
164 ci->ci_newID = id;
165 hash_add(&aff->af_comp, ci->ci_key);
166 }
167 ***************
168 *** 7364,7373 ****
169
170 if (bl == NULL || bl->sb_used + len > SBLOCKSIZE)
171 {
172 ! /* Allocate a block of memory. This is not freed until much later. */
173 ! bl = (sblock_T *)alloc_clear((unsigned)(sizeof(sblock_T) + SBLOCKSIZE));
174 if (bl == NULL)
175 return NULL;
176 bl->sb_next = spin->si_blocks;
177 spin->si_blocks = bl;
178 bl->sb_used = 0;
179 --- 7370,7390 ----
180
181 if (bl == NULL || bl->sb_used + len > SBLOCKSIZE)
182 {
183 ! if (len >= SBLOCKSIZE)
184 ! bl = NULL;
185 ! else
186 ! /* Allocate a block of memory. It is not freed until much later. */
187 ! bl = (sblock_T *)alloc_clear(
188 ! (unsigned)(sizeof(sblock_T) + SBLOCKSIZE));
189 if (bl == NULL)
190 + {
191 + if (!spin->si_did_emsg)
192 + {
193 + EMSG(_("E845: Insufficient memory, word list will be incomplete"));
194 + spin->si_did_emsg = TRUE;
195 + }
196 return NULL;
197 + }
198 bl->sb_next = spin->si_blocks;
199 spin->si_blocks = bl;
200 bl->sb_used = 0;
201 ***************
202 *** 7382,7387 ****
203 --- 7399,7405 ----
204
205 /*
206 * Make a copy of a string into memory allocated with getroom().
207 + * Returns NULL when out of memory.
208 */
209 static char_u *
210 getroom_save(spin, s)
211 ***************
212 *** 7416,7421 ****
213 --- 7434,7440 ----
214
215 /*
216 * Allocate the root of a word tree.
217 + * Returns NULL when out of memory.
218 */
219 static wordnode_T *
220 wordtree_alloc(spin)
221 ***************
222 *** 7700,7705 ****
223 --- 7719,7725 ----
224 /*
225 * Get a wordnode_T, either from the list of previously freed nodes or
226 * allocate a new one.
227 + * Returns NULL when out of memory.
228 */
229 static wordnode_T *
230 get_wordnode(spin)
231 ***************
232 *** 7717,7723 ****
233 --spin->si_free_count;
234 }
235 #ifdef SPELL_PRINTTREE
236 ! n->wn_nr = ++spin->si_wordnode_nr;
237 #endif
238 return n;
239 }
240 --- 7737,7744 ----
241 --spin->si_free_count;
242 }
243 #ifdef SPELL_PRINTTREE
244 ! if (n != NULL)
245 ! n->wn_nr = ++spin->si_wordnode_nr;
246 #endif
247 return n;
248 }
249 *** ../vim-7.3.108/src/version.c 2011-02-01 13:48:47.000000000 +0100
250 --- src/version.c 2011-02-01 13:56:38.000000000 +0100
251 ***************
252 *** 716,717 ****
253 --- 716,719 ----
254 { /* Add new patch number below this line */
255 + /**/
256 + 109,
257 /**/
258
259 --
260 hundred-and-one symptoms of being an internet addict:
261 174. You know what a listserv is.
262
263 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
264 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
265 \\\ an exciting new programming language -- http://www.Zimbu.org ///
266 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///