Mercurial > vim
annotate runtime/syntax/smcl.vim @ 33776:9503dc55b5ed v9.0.2108
patch 9.0.2108: [security]: overflow with count for :s command
Commit: https://github.com/vim/vim/commit/ac63787734fda2e294e477af52b3bd601517fa78
Author: Christian Brabandt <cb@256bit.org>
Date: Tue Nov 14 20:45:48 2023 +0100
patch 9.0.2108: [security]: overflow with count for :s command
Problem: [security]: overflow with count for :s command
Solution: Abort the :s command if the count is too large
If the count after the :s command is larger than what fits into a
(signed) long variable, abort with e_value_too_large.
Adds a test with INT_MAX as count and verify it correctly fails.
It seems the return value on Windows using mingw compiler wraps around,
so the initial test using :s/./b/9999999999999999999999999990 doesn't
fail there, since the count is wrapping around several times and finally
is no longer larger than 2147483647. So let's just use 2147483647 in the
test, which hopefully will always cause a failure
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 16 Nov 2023 22:15:10 +0100 |
parents | 43efa4f5a8ea |
children |
rev | line source |
---|---|
844 | 1 " smcl.vim -- Vim syntax file for smcl files. |
831 | 2 " Language: SMCL -- Stata Markup and Control Language |
3 " Maintainer: Jeff Pitblado <jpitblado@stata.com> | |
844 | 4 " Last Change: 26apr2006 |
5 " Version: 1.1.2 | |
831 | 6 |
7 " Log: | |
8 " 20mar2003 updated the match definition for cmdab | |
9 " 14apr2006 'syntax clear' only under version control | |
10 " check for 'b:current_syntax', removed 'did_smcl_syntax_inits' | |
844 | 11 " 26apr2006 changed 'stata_smcl' to 'smcl' |
831 | 12 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
844
diff
changeset
|
13 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
844
diff
changeset
|
14 if exists("b:current_syntax") |
831 | 15 finish |
16 endif | |
17 | |
18 syntax case match | |
19 | |
20 syn keyword smclCCLword current_date contained | |
21 syn keyword smclCCLword current_time contained | |
22 syn keyword smclCCLword rmsg_time contained | |
23 syn keyword smclCCLword stata_version contained | |
24 syn keyword smclCCLword version contained | |
25 syn keyword smclCCLword born_date contained | |
26 syn keyword smclCCLword flavor contained | |
27 syn keyword smclCCLword SE contained | |
28 syn keyword smclCCLword mode contained | |
29 syn keyword smclCCLword console contained | |
30 syn keyword smclCCLword os contained | |
31 syn keyword smclCCLword osdtl contained | |
32 syn keyword smclCCLword machine_type contained | |
33 syn keyword smclCCLword byteorder contained | |
34 syn keyword smclCCLword sysdir_stata contained | |
35 syn keyword smclCCLword sysdir_updates contained | |
36 syn keyword smclCCLword sysdir_base contained | |
37 syn keyword smclCCLword sysdir_site contained | |
38 syn keyword smclCCLword sysdir_plus contained | |
39 syn keyword smclCCLword sysdir_personal contained | |
40 syn keyword smclCCLword sysdir_oldplace contained | |
41 syn keyword smclCCLword adopath contained | |
42 syn keyword smclCCLword pwd contained | |
43 syn keyword smclCCLword dirsep contained | |
44 syn keyword smclCCLword max_N_theory contained | |
45 syn keyword smclCCLword max_N_current contained | |
46 syn keyword smclCCLword max_k_theory contained | |
47 syn keyword smclCCLword max_k_current contained | |
48 syn keyword smclCCLword max_width_theory contained | |
49 syn keyword smclCCLword max_width_current contained | |
50 syn keyword smclCCLword max_matsize contained | |
51 syn keyword smclCCLword min_matsize contained | |
52 syn keyword smclCCLword max_macrolen contained | |
53 syn keyword smclCCLword macrolen contained | |
54 syn keyword smclCCLword max_cmdlen contained | |
55 syn keyword smclCCLword cmdlen contained | |
56 syn keyword smclCCLword namelen contained | |
57 syn keyword smclCCLword mindouble contained | |
58 syn keyword smclCCLword maxdouble contained | |
59 syn keyword smclCCLword epsdouble contained | |
60 syn keyword smclCCLword minfloat contained | |
61 syn keyword smclCCLword maxfloat contained | |
62 syn keyword smclCCLword epsfloat contained | |
63 syn keyword smclCCLword minlong contained | |
64 syn keyword smclCCLword maxlong contained | |
65 syn keyword smclCCLword minint contained | |
66 syn keyword smclCCLword maxint contained | |
67 syn keyword smclCCLword minbyte contained | |
68 syn keyword smclCCLword maxbyte contained | |
69 syn keyword smclCCLword maxstrvarlen contained | |
70 syn keyword smclCCLword memory contained | |
71 syn keyword smclCCLword maxvar contained | |
72 syn keyword smclCCLword matsize contained | |
73 syn keyword smclCCLword N contained | |
74 syn keyword smclCCLword k contained | |
75 syn keyword smclCCLword width contained | |
76 syn keyword smclCCLword changed contained | |
77 syn keyword smclCCLword filename contained | |
78 syn keyword smclCCLword filedate contained | |
79 syn keyword smclCCLword more contained | |
80 syn keyword smclCCLword rmsg contained | |
81 syn keyword smclCCLword dp contained | |
82 syn keyword smclCCLword linesize contained | |
83 syn keyword smclCCLword pagesize contained | |
84 syn keyword smclCCLword logtype contained | |
85 syn keyword smclCCLword linegap contained | |
86 syn keyword smclCCLword scrollbufsize contained | |
87 syn keyword smclCCLword varlabelpos contained | |
88 syn keyword smclCCLword reventries contained | |
89 syn keyword smclCCLword graphics contained | |
90 syn keyword smclCCLword scheme contained | |
91 syn keyword smclCCLword printcolor contained | |
92 syn keyword smclCCLword adosize contained | |
93 syn keyword smclCCLword maxdb contained | |
94 syn keyword smclCCLword virtual contained | |
95 syn keyword smclCCLword checksum contained | |
96 syn keyword smclCCLword timeout1 contained | |
97 syn keyword smclCCLword timeout2 contained | |
98 syn keyword smclCCLword httpproxy contained | |
99 syn keyword smclCCLword h_current contained | |
100 syn keyword smclCCLword max_matsize contained | |
101 syn keyword smclCCLword min_matsize contained | |
102 syn keyword smclCCLword max_macrolen contained | |
103 syn keyword smclCCLword macrolen contained | |
104 syn keyword smclCCLword max_cmdlen contained | |
105 syn keyword smclCCLword cmdlen contained | |
106 syn keyword smclCCLword namelen contained | |
107 syn keyword smclCCLword mindouble contained | |
108 syn keyword smclCCLword maxdouble contained | |
109 syn keyword smclCCLword epsdouble contained | |
110 syn keyword smclCCLword minfloat contained | |
111 syn keyword smclCCLword maxfloat contained | |
112 syn keyword smclCCLword epsfloat contained | |
113 syn keyword smclCCLword minlong contained | |
114 syn keyword smclCCLword maxlong contained | |
115 syn keyword smclCCLword minint contained | |
116 syn keyword smclCCLword maxint contained | |
117 syn keyword smclCCLword minbyte contained | |
118 syn keyword smclCCLword maxbyte contained | |
119 syn keyword smclCCLword maxstrvarlen contained | |
120 syn keyword smclCCLword memory contained | |
121 syn keyword smclCCLword maxvar contained | |
122 syn keyword smclCCLword matsize contained | |
123 syn keyword smclCCLword N contained | |
124 syn keyword smclCCLword k contained | |
125 syn keyword smclCCLword width contained | |
126 syn keyword smclCCLword changed contained | |
127 syn keyword smclCCLword filename contained | |
128 syn keyword smclCCLword filedate contained | |
129 syn keyword smclCCLword more contained | |
130 syn keyword smclCCLword rmsg contained | |
131 syn keyword smclCCLword dp contained | |
132 syn keyword smclCCLword linesize contained | |
133 syn keyword smclCCLword pagesize contained | |
134 syn keyword smclCCLword logtype contained | |
135 syn keyword smclCCLword linegap contained | |
136 syn keyword smclCCLword scrollbufsize contained | |
137 syn keyword smclCCLword varlabelpos contained | |
138 syn keyword smclCCLword reventries contained | |
139 syn keyword smclCCLword graphics contained | |
140 syn keyword smclCCLword scheme contained | |
141 syn keyword smclCCLword printcolor contained | |
142 syn keyword smclCCLword adosize contained | |
143 syn keyword smclCCLword maxdb contained | |
144 syn keyword smclCCLword virtual contained | |
145 syn keyword smclCCLword checksum contained | |
146 syn keyword smclCCLword timeout1 contained | |
147 syn keyword smclCCLword timeout2 contained | |
148 syn keyword smclCCLword httpproxy contained | |
149 syn keyword smclCCLword httpproxyhost contained | |
150 syn keyword smclCCLword httpproxyport contained | |
151 syn keyword smclCCLword httpproxyauth contained | |
152 syn keyword smclCCLword httpproxyuser contained | |
153 syn keyword smclCCLword httpproxypw contained | |
154 syn keyword smclCCLword trace contained | |
155 syn keyword smclCCLword tracedepth contained | |
156 syn keyword smclCCLword tracesep contained | |
157 syn keyword smclCCLword traceindent contained | |
158 syn keyword smclCCLword traceexapnd contained | |
159 syn keyword smclCCLword tracenumber contained | |
160 syn keyword smclCCLword type contained | |
161 syn keyword smclCCLword level contained | |
162 syn keyword smclCCLword seed contained | |
163 syn keyword smclCCLword searchdefault contained | |
164 syn keyword smclCCLword pi contained | |
165 syn keyword smclCCLword rc contained | |
166 | |
167 " Directive for the contant and current-value class | |
168 syn region smclCCL start=/{ccl / end=/}/ oneline contains=smclCCLword | |
169 | |
170 " The order of the following syntax definitions is roughly that of the on-line | |
171 " documentation for smcl in Stata, from within Stata see help smcl. | |
172 | |
173 " Format directives for line and paragraph modes | |
174 syn match smclFormat /{smcl}/ | |
175 syn match smclFormat /{sf\(\|:[^}]\+\)}/ | |
176 syn match smclFormat /{it\(\|:[^}]\+\)}/ | |
177 syn match smclFormat /{bf\(\|:[^}]\+\)}/ | |
178 syn match smclFormat /{inp\(\|:[^}]\+\)}/ | |
179 syn match smclFormat /{input\(\|:[^}]\+\)}/ | |
180 syn match smclFormat /{err\(\|:[^}]\+\)}/ | |
181 syn match smclFormat /{error\(\|:[^}]\+\)}/ | |
182 syn match smclFormat /{res\(\|:[^}]\+\)}/ | |
183 syn match smclFormat /{result\(\|:[^}]\+\)}/ | |
184 syn match smclFormat /{txt\(\|:[^}]\+\)}/ | |
185 syn match smclFormat /{text\(\|:[^}]\+\)}/ | |
186 syn match smclFormat /{com\(\|:[^}]\+\)}/ | |
187 syn match smclFormat /{cmd\(\|:[^}]\+\)}/ | |
188 syn match smclFormat /{cmdab:[^:}]\+:[^:}()]*\(\|:\|:(\|:()\)}/ | |
189 syn match smclFormat /{hi\(\|:[^}]\+\)}/ | |
190 syn match smclFormat /{hilite\(\|:[^}]\+\)}/ | |
191 syn match smclFormat /{ul \(on\|off\)}/ | |
192 syn match smclFormat /{ul:[^}]\+}/ | |
193 syn match smclFormat /{hline\(\| \d\+\| -\d\+\|:[^}]\+\)}/ | |
194 syn match smclFormat /{dup \d\+:[^}]\+}/ | |
195 syn match smclFormat /{c [^}]\+}/ | |
196 syn match smclFormat /{char [^}]\+}/ | |
197 syn match smclFormat /{reset}/ | |
198 | |
199 " Formatting directives for line mode | |
200 syn match smclFormat /{title:[^}]\+}/ | |
201 syn match smclFormat /{center:[^}]\+}/ | |
202 syn match smclFormat /{centre:[^}]\+}/ | |
203 syn match smclFormat /{center \d\+:[^}]\+}/ | |
204 syn match smclFormat /{centre \d\+:[^}]\+}/ | |
205 syn match smclFormat /{right:[^}]\+}/ | |
206 syn match smclFormat /{lalign \d\+:[^}]\+}/ | |
207 syn match smclFormat /{ralign \d\+:[^}]\+}/ | |
208 syn match smclFormat /{\.\.\.}/ | |
209 syn match smclFormat /{col \d\+}/ | |
210 syn match smclFormat /{space \d\+}/ | |
211 syn match smclFormat /{tab}/ | |
212 | |
213 " Formatting directives for paragraph mode | |
214 syn match smclFormat /{bind:[^}]\+}/ | |
215 syn match smclFormat /{break}/ | |
216 | |
217 syn match smclFormat /{p}/ | |
218 syn match smclFormat /{p \d\+}/ | |
219 syn match smclFormat /{p \d\+ \d\+}/ | |
220 syn match smclFormat /{p \d\+ \d\+ \d\+}/ | |
221 syn match smclFormat /{pstd}/ | |
222 syn match smclFormat /{psee}/ | |
223 syn match smclFormat /{phang\(\|2\|3\)}/ | |
224 syn match smclFormat /{pmore\(\|2\|3\)}/ | |
225 syn match smclFormat /{pin\(\|2\|3\)}/ | |
226 syn match smclFormat /{p_end}/ | |
227 | |
228 syn match smclFormat /{opt \w\+\(\|:\w\+\)\(\|([^)}]*)\)}/ | |
229 | |
230 syn match smclFormat /{opth \w*\(\|:\w\+\)(\w*)}/ | |
231 syn match smclFormat /{opth "\w\+\((\w\+:[^)}]\+)\)"}/ | |
232 syn match smclFormat /{opth \w\+:\w\+(\w\+:[^)}]\+)}/ | |
233 | |
234 syn match smclFormat /{dlgtab\s*\(\|\d\+\|\d\+\s\+\d\+\):[^}]\+}/ | |
235 | |
236 syn match smclFormat /{p2colset\s\+\d\+\s\+\d\+\s\+\d\+\s\+\d\+}/ | |
237 syn match smclFormat /{p2col\s\+:[^{}]*}.*{p_end}/ | |
238 syn match smclFormat /{p2col\s\+:{[^{}]*}}.*{p_end}/ | |
239 syn match smclFormat /{p2coldent\s*:[^{}]*}.*{p_end}/ | |
240 syn match smclFormat /{p2coldent\s*:{[^{}]*}}.*{p_end}/ | |
241 syn match smclFormat /{p2line\s*\(\|\d\+\s\+\d\+\)}/ | |
242 syn match smclFormat /{p2colreset}/ | |
243 | |
244 syn match smclFormat /{synoptset\s\+\d\+\s\+\w\+}/ | |
245 syn match smclFormat /{synopt\s*:[^{}]*}.*{p_end}/ | |
246 syn match smclFormat /{synopt\s*:{[^{}]*}}.*{p_end}/ | |
247 syn match smclFormat /{syntab\s*:[^{}]*}/ | |
248 syn match smclFormat /{synopthdr}/ | |
249 syn match smclFormat /{synoptline}/ | |
250 | |
251 " Link directive for line and paragraph modes | |
252 syn match smclLink /{help [^}]\+}/ | |
253 syn match smclLink /{helpb [^}]\+}/ | |
254 syn match smclLink /{help_d:[^}]\+}/ | |
255 syn match smclLink /{search [^}]\+}/ | |
256 syn match smclLink /{search_d:[^}]\+}/ | |
257 syn match smclLink /{browse [^}]\+}/ | |
258 syn match smclLink /{view [^}]\+}/ | |
259 syn match smclLink /{view_d:[^}]\+}/ | |
260 syn match smclLink /{news:[^}]\+}/ | |
261 syn match smclLink /{net [^}]\+}/ | |
262 syn match smclLink /{net_d:[^}]\+}/ | |
263 syn match smclLink /{netfrom_d:[^}]\+}/ | |
264 syn match smclLink /{ado [^}]\+}/ | |
265 syn match smclLink /{ado_d:[^}]\+}/ | |
266 syn match smclLink /{update [^}]\+}/ | |
267 syn match smclLink /{update_d:[^}]\+}/ | |
268 syn match smclLink /{dialog [^}]\+}/ | |
269 syn match smclLink /{back:[^}]\+}/ | |
270 syn match smclLink /{clearmore:[^}]\+}/ | |
271 syn match smclLink /{stata [^}]\+}/ | |
272 | |
273 syn match smclLink /{newvar\(\|:[^}]\+\)}/ | |
274 syn match smclLink /{var\(\|:[^}]\+\)}/ | |
275 syn match smclLink /{varname\(\|:[^}]\+\)}/ | |
276 syn match smclLink /{vars\(\|:[^}]\+\)}/ | |
277 syn match smclLink /{varlist\(\|:[^}]\+\)}/ | |
278 syn match smclLink /{depvar\(\|:[^}]\+\)}/ | |
279 syn match smclLink /{depvars\(\|:[^}]\+\)}/ | |
280 syn match smclLink /{depvarlist\(\|:[^}]\+\)}/ | |
281 syn match smclLink /{indepvars\(\|:[^}]\+\)}/ | |
282 | |
283 syn match smclLink /{dtype}/ | |
284 syn match smclLink /{ifin}/ | |
285 syn match smclLink /{weight}/ | |
286 | |
287 " Comment | |
288 syn region smclComment start=/{\*/ end=/}/ oneline | |
289 | |
290 " Strings | |
291 syn region smclString matchgroup=Nothing start=/"/ end=/"/ oneline | |
292 syn region smclEString matchgroup=Nothing start=/`"/ end=/"'/ oneline contains=smclEString | |
293 | |
294 " assign highlight groups | |
295 | |
296 hi def link smclEString smclString | |
297 | |
298 hi def link smclCCLword Statement | |
299 hi def link smclCCL Type | |
300 hi def link smclFormat Statement | |
301 hi def link smclLink Underlined | |
302 hi def link smclComment Comment | |
303 hi def link smclString String | |
304 | |
844 | 305 let b:current_syntax = "smcl" |
831 | 306 |
307 " vim: ts=8 |