]>
Commit | Line | Data |
---|---|---|
6577e359 | 1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.054 | |
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.054 | |
11 | Problem: Accessing uninitialized memory when displaying the fold column. | |
12 | Solution: Add a NUL to the extra array. (Dominique Pelle). Also do this in | |
13 | a couple of other situations. | |
14 | Files: src/screen.c | |
15 | ||
16 | ||
17 | *** ../vim-7.1.053/src/screen.c Mon Jul 30 21:59:50 2007 | |
18 | --- src/screen.c Sun Aug 5 16:10:53 2007 | |
19 | *************** | |
20 | *** 2555,2561 **** | |
21 | ||
22 | char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ | |
23 | int n_extra = 0; /* number of extra chars */ | |
24 | ! char_u *p_extra = NULL; /* string of extra chars */ | |
25 | int c_extra = NUL; /* extra chars, all the same */ | |
26 | int extra_attr = 0; /* attributes when n_extra != 0 */ | |
27 | static char_u *at_end_str = (char_u *)""; /* used for p_extra when | |
28 | --- 2555,2561 ---- | |
29 | ||
30 | char_u extra[18]; /* "%ld" and 'fdc' must fit in here */ | |
31 | int n_extra = 0; /* number of extra chars */ | |
32 | ! char_u *p_extra = NULL; /* string of extra chars, plus NUL */ | |
33 | int c_extra = NUL; /* extra chars, all the same */ | |
34 | int extra_attr = 0; /* attributes when n_extra != 0 */ | |
35 | static char_u *at_end_str = (char_u *)""; /* used for p_extra when | |
36 | *************** | |
37 | *** 3189,3198 **** | |
38 | if (cmdwin_type != 0 && wp == curwin) | |
39 | { | |
40 | /* Draw the cmdline character. */ | |
41 | - *extra = cmdwin_type; | |
42 | n_extra = 1; | |
43 | ! p_extra = extra; | |
44 | ! c_extra = NUL; | |
45 | char_attr = hl_attr(HLF_AT); | |
46 | } | |
47 | } | |
48 | --- 3189,3196 ---- | |
49 | if (cmdwin_type != 0 && wp == curwin) | |
50 | { | |
51 | /* Draw the cmdline character. */ | |
52 | n_extra = 1; | |
53 | ! c_extra = cmdwin_type; | |
54 | char_attr = hl_attr(HLF_AT); | |
55 | } | |
56 | } | |
57 | *************** | |
58 | *** 3208,3213 **** | |
59 | --- 3206,3212 ---- | |
60 | fill_foldcolumn(extra, wp, FALSE, lnum); | |
61 | n_extra = wp->w_p_fdc; | |
62 | p_extra = extra; | |
63 | + p_extra[n_extra] = NUL; | |
64 | c_extra = NUL; | |
65 | char_attr = hl_attr(HLF_FC); | |
66 | } | |
67 | *************** | |
68 | *** 3550,3558 **** | |
69 | * Get the next character to put on the screen. | |
70 | */ | |
71 | /* | |
72 | ! * The 'extra' array contains the extra stuff that is inserted to | |
73 | ! * represent special characters (non-printable stuff). When all | |
74 | ! * characters are the same, c_extra is used. | |
75 | * For the '$' of the 'list' option, n_extra == 1, p_extra == "". | |
76 | */ | |
77 | if (n_extra > 0) | |
78 | --- 3549,3559 ---- | |
79 | * Get the next character to put on the screen. | |
80 | */ | |
81 | /* | |
82 | ! * The "p_extra" points to the extra stuff that is inserted to | |
83 | ! * represent special characters (non-printable stuff) and other | |
84 | ! * things. When all characters are the same, c_extra is used. | |
85 | ! * "p_extra" must end in a NUL to avoid mb_ptr2len() reads past | |
86 | ! * "p_extra[n_extra]". | |
87 | * For the '$' of the 'list' option, n_extra == 1, p_extra == "". | |
88 | */ | |
89 | if (n_extra > 0) | |
90 | *************** | |
91 | *** 3808,3817 **** | |
92 | * a '<' in the first column. */ | |
93 | if (n_skip > 0 && mb_l > 1) | |
94 | { | |
95 | - extra[0] = '<'; | |
96 | - p_extra = extra; | |
97 | n_extra = 1; | |
98 | ! c_extra = NUL; | |
99 | c = ' '; | |
100 | if (area_attr == 0 && search_attr == 0) | |
101 | { | |
102 | --- 3809,3816 ---- | |
103 | * a '<' in the first column. */ | |
104 | if (n_skip > 0 && mb_l > 1) | |
105 | { | |
106 | n_extra = 1; | |
107 | ! c_extra = '<'; | |
108 | c = ' '; | |
109 | if (area_attr == 0 && search_attr == 0) | |
110 | { | |
111 | *************** | |
112 | *** 6204,6211 **** | |
113 | return; | |
114 | ||
115 | off = LineOffset[row] + col; | |
116 | ! while (*ptr != NUL && col < screen_Columns | |
117 | ! && (len < 0 || (int)(ptr - text) < len)) | |
118 | { | |
119 | c = *ptr; | |
120 | #ifdef FEAT_MBYTE | |
121 | --- 6203,6211 ---- | |
122 | return; | |
123 | ||
124 | off = LineOffset[row] + col; | |
125 | ! while (col < screen_Columns | |
126 | ! && (len < 0 || (int)(ptr - text) < len) | |
127 | ! && *ptr != NUL) | |
128 | { | |
129 | c = *ptr; | |
130 | #ifdef FEAT_MBYTE | |
131 | *** ../vim-7.1.053/src/version.c Sun Aug 5 19:20:04 2007 | |
132 | --- src/version.c Sun Aug 5 20:07:47 2007 | |
133 | *************** | |
134 | *** 668,669 **** | |
135 | --- 668,671 ---- | |
136 | { /* Add new patch number below this line */ | |
137 | + /**/ | |
138 | + 54, | |
139 | /**/ | |
140 | ||
141 | -- | |
142 | From "know your smileys": | |
143 | +<(:-) The Pope | |
144 | ||
145 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
146 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
147 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
148 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |