]>
Commit | Line | Data |
---|---|---|
142b4b8e AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.021 | |
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.0.021 | |
11 | Problem: Crash when using "\\[" and "\\]" in 'errorformat'. (Marc Weber) | |
12 | Solution: Check for valid submatches after matching the pattern. | |
13 | Files: src/quickfix.c | |
14 | ||
15 | ||
16 | *** ../vim-7.0.020/src/quickfix.c Wed May 3 23:23:30 2006 | |
17 | --- src/quickfix.c Tue Jun 20 17:04:20 2006 | |
18 | *************** | |
19 | *** 602,614 **** | |
20 | else | |
21 | type = 0; | |
22 | /* | |
23 | ! * Extract error message data from matched line | |
24 | */ | |
25 | if ((i = (int)fmt_ptr->addr[0]) > 0) /* %f */ | |
26 | { | |
27 | ! int c = *regmatch.endp[i]; | |
28 | ||
29 | /* Expand ~/file and $HOME/file to full path. */ | |
30 | *regmatch.endp[i] = NUL; | |
31 | expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE); | |
32 | *regmatch.endp[i] = c; | |
33 | --- 602,620 ---- | |
34 | else | |
35 | type = 0; | |
36 | /* | |
37 | ! * Extract error message data from matched line. | |
38 | ! * We check for an actual submatch, because "\[" and "\]" in | |
39 | ! * the 'errorformat' may cause the wrong submatch to be used. | |
40 | */ | |
41 | if ((i = (int)fmt_ptr->addr[0]) > 0) /* %f */ | |
42 | { | |
43 | ! int c; | |
44 | ! | |
45 | ! if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) | |
46 | ! continue; | |
47 | ||
48 | /* Expand ~/file and $HOME/file to full path. */ | |
49 | + c = *regmatch.endp[i]; | |
50 | *regmatch.endp[i] = NUL; | |
51 | expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE); | |
52 | *regmatch.endp[i] = c; | |
53 | *************** | |
54 | *** 618,652 **** | |
55 | --- 624,686 ---- | |
56 | continue; | |
57 | } | |
58 | if ((i = (int)fmt_ptr->addr[1]) > 0) /* %n */ | |
59 | + { | |
60 | + if (regmatch.startp[i] == NULL) | |
61 | + continue; | |
62 | enr = (int)atol((char *)regmatch.startp[i]); | |
63 | + } | |
64 | if ((i = (int)fmt_ptr->addr[2]) > 0) /* %l */ | |
65 | + { | |
66 | + if (regmatch.startp[i] == NULL) | |
67 | + continue; | |
68 | lnum = atol((char *)regmatch.startp[i]); | |
69 | + } | |
70 | if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */ | |
71 | + { | |
72 | + if (regmatch.startp[i] == NULL) | |
73 | + continue; | |
74 | col = (int)atol((char *)regmatch.startp[i]); | |
75 | + } | |
76 | if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */ | |
77 | + { | |
78 | + if (regmatch.startp[i] == NULL) | |
79 | + continue; | |
80 | type = *regmatch.startp[i]; | |
81 | + } | |
82 | if (fmt_ptr->flags == '+' && !multiscan) /* %+ */ | |
83 | STRCPY(errmsg, IObuff); | |
84 | else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */ | |
85 | { | |
86 | + if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) | |
87 | + continue; | |
88 | len = (int)(regmatch.endp[i] - regmatch.startp[i]); | |
89 | vim_strncpy(errmsg, regmatch.startp[i], len); | |
90 | } | |
91 | if ((i = (int)fmt_ptr->addr[6]) > 0) /* %r */ | |
92 | + { | |
93 | + if (regmatch.startp[i] == NULL) | |
94 | + continue; | |
95 | tail = regmatch.startp[i]; | |
96 | + } | |
97 | if ((i = (int)fmt_ptr->addr[7]) > 0) /* %p */ | |
98 | { | |
99 | + if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) | |
100 | + continue; | |
101 | col = (int)(regmatch.endp[i] - regmatch.startp[i] + 1); | |
102 | if (*((char_u *)regmatch.startp[i]) != TAB) | |
103 | use_viscol = TRUE; | |
104 | } | |
105 | if ((i = (int)fmt_ptr->addr[8]) > 0) /* %v */ | |
106 | { | |
107 | + if (regmatch.startp[i] == NULL) | |
108 | + continue; | |
109 | col = (int)atol((char *)regmatch.startp[i]); | |
110 | use_viscol = TRUE; | |
111 | } | |
112 | if ((i = (int)fmt_ptr->addr[9]) > 0) /* %s */ | |
113 | { | |
114 | + if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) | |
115 | + continue; | |
116 | len = (int)(regmatch.endp[i] - regmatch.startp[i]); | |
117 | if (len > CMDBUFFSIZE - 5) | |
118 | len = CMDBUFFSIZE - 5; | |
119 | *** ../vim-7.0.020/src/version.c Tue Jun 20 16:33:21 2006 | |
120 | --- src/version.c Tue Jun 20 17:07:25 2006 | |
121 | *************** | |
122 | *** 668,669 **** | |
123 | --- 668,671 ---- | |
124 | { /* Add new patch number below this line */ | |
125 | + /**/ | |
126 | + 21, | |
127 | /**/ | |
128 | ||
129 | -- | |
130 | TALL KNIGHT: We are now no longer the Knights Who Say Ni! | |
131 | ONE KNIGHT: Ni! | |
132 | OTHERS: Sh! | |
133 | ONE KNIGHT: (whispers) Sorry. | |
134 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
135 | ||
136 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
137 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
138 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
139 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |