]>
Commit | Line | Data |
---|---|---|
6577e359 | 1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.051 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.051 | |
11 | Problem: Accessing uninitialized memory when finding spell suggestions. | |
12 | Solution: Don't try swapping characters at the end of a word. | |
13 | Files: src/spell.c | |
14 | ||
15 | ||
16 | *** ../vim-7.1.050/src/spell.c Tue Jul 24 10:44:10 2007 | |
17 | --- src/spell.c Sun Aug 5 16:59:48 2007 | |
18 | *************** | |
19 | *** 12182,12188 **** | |
20 | { | |
21 | n = mb_cptr2len(p); | |
22 | c = mb_ptr2char(p); | |
23 | ! if (!soundfold && !spell_iswordp(p + n, curbuf)) | |
24 | c2 = c; /* don't swap non-word char */ | |
25 | else | |
26 | c2 = mb_ptr2char(p + n); | |
27 | --- 12182,12190 ---- | |
28 | { | |
29 | n = mb_cptr2len(p); | |
30 | c = mb_ptr2char(p); | |
31 | ! if (p[n] == NUL) | |
32 | ! c2 = NUL; | |
33 | ! else if (!soundfold && !spell_iswordp(p + n, curbuf)) | |
34 | c2 = c; /* don't swap non-word char */ | |
35 | else | |
36 | c2 = mb_ptr2char(p + n); | |
37 | *************** | |
38 | *** 12190,12199 **** | |
39 | else | |
40 | #endif | |
41 | { | |
42 | ! if (!soundfold && !spell_iswordp(p + 1, curbuf)) | |
43 | c2 = c; /* don't swap non-word char */ | |
44 | else | |
45 | c2 = p[1]; | |
46 | } | |
47 | ||
48 | /* When characters are identical, swap won't do anything. | |
49 | --- 12192,12210 ---- | |
50 | else | |
51 | #endif | |
52 | { | |
53 | ! if (p[1] == NUL) | |
54 | ! c2 = NUL; | |
55 | ! else if (!soundfold && !spell_iswordp(p + 1, curbuf)) | |
56 | c2 = c; /* don't swap non-word char */ | |
57 | else | |
58 | c2 = p[1]; | |
59 | + } | |
60 | + | |
61 | + /* When the second character is NUL we can't swap. */ | |
62 | + if (c2 == NUL) | |
63 | + { | |
64 | + sp->ts_state = STATE_REP_INI; | |
65 | + break; | |
66 | } | |
67 | ||
68 | /* When characters are identical, swap won't do anything. | |
69 | *** ../vim-7.1.050/src/version.c Sat Aug 4 12:14:04 2007 | |
70 | --- src/version.c Sun Aug 5 18:31:09 2007 | |
71 | *************** | |
72 | *** 668,669 **** | |
73 | --- 668,671 ---- | |
74 | { /* Add new patch number below this line */ | |
75 | + /**/ | |
76 | + 51, | |
77 | /**/ | |
78 | ||
79 | -- | |
80 | From "know your smileys": | |
81 | 8<}} Glasses, big nose, beard | |
82 | ||
83 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
84 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
85 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
86 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |