/src/trafficserver/include/tscore/ParseRules.h
Line | Count | Source |
1 | | /** @file |
2 | | |
3 | | A brief file description |
4 | | |
5 | | @section license License |
6 | | |
7 | | Licensed to the Apache Software Foundation (ASF) under one |
8 | | or more contributor license agreements. See the NOTICE file |
9 | | distributed with this work for additional information |
10 | | regarding copyright ownership. The ASF licenses this file |
11 | | to you under the Apache License, Version 2.0 (the |
12 | | "License"); you may not use this file except in compliance |
13 | | with the License. You may obtain a copy of the License at |
14 | | |
15 | | http://www.apache.org/licenses/LICENSE-2.0 |
16 | | |
17 | | Unless required by applicable law or agreed to in writing, software |
18 | | distributed under the License is distributed on an "AS IS" BASIS, |
19 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
20 | | See the License for the specific language governing permissions and |
21 | | limitations under the License. |
22 | | */ |
23 | | |
24 | | #pragma once |
25 | | |
26 | | #include <cstring> |
27 | | |
28 | | #include "tscore/ink_platform.h" |
29 | | #include "tscore/ink_defs.h" |
30 | | #include "tscore/ink_apidefs.h" |
31 | | |
32 | | using CTypeResult = unsigned int; |
33 | | |
34 | | // Set this to 0 to disable SI |
35 | | // decimal multipliers |
36 | | #define USE_SI_MULTIPLIERS 1 |
37 | | |
38 | | #define is_char_BIT (1 << 0) |
39 | 0 | #define is_upalpha_BIT (1 << 1) |
40 | | #define is_loalpha_BIT (1 << 2) |
41 | 254 | #define is_alpha_BIT (1 << 3) |
42 | 4.93k | #define is_digit_BIT (1 << 4) |
43 | | #define is_ctl_BIT (1 << 5) |
44 | 84.7k | #define is_ws_BIT (1 << 6) |
45 | 6 | #define is_hex_BIT (1 << 7) |
46 | | #define is_pchar_BIT (1 << 8) |
47 | | #define is_extra_BIT (1 << 9) |
48 | | #define is_safe_BIT (1 << 10) |
49 | | #define is_unsafe_BIT (1 << 11) |
50 | | #define is_national_BIT (1 << 12) |
51 | | #define is_reserved_BIT (1 << 13) |
52 | | #define is_unreserved_BIT (1 << 14) |
53 | | #define is_punct_BIT (1 << 15) |
54 | | #define is_end_of_url_BIT (1 << 16) |
55 | | #define is_tspecials_BIT (1 << 17) |
56 | | #define is_spcr_BIT (1 << 18) |
57 | | #define is_splf_BIT (1 << 19) |
58 | 27.9k | #define is_wslfcr_BIT (1 << 20) |
59 | 0 | #define is_eow_BIT (1 << 21) |
60 | 42.7k | #define is_token_BIT (1 << 22) |
61 | 0 | #define is_uri_BIT (1 << 23) |
62 | | #define is_sep_BIT (1 << 24) |
63 | | #define is_empty_BIT (1 << 25) |
64 | 19.4k | #define is_alnum_BIT (1 << 26) |
65 | 751 | #define is_space_BIT (1 << 27) |
66 | 46.2k | #define is_control_BIT (1 << 28) |
67 | | #define is_mime_sep_BIT (1 << 29) |
68 | 22.0k | #define is_http_field_name_BIT (1 << 30) |
69 | | /* shut up the DEC compiler */ |
70 | | #define is_http_field_value_BIT (((CTypeResult)1) << 31) |
71 | | |
72 | | extern const CTypeResult parseRulesCType[]; |
73 | | extern const char parseRulesCTypeToUpper[]; |
74 | | extern const char parseRulesCTypeToLower[]; |
75 | | |
76 | | class ParseRules |
77 | | { |
78 | | public: |
79 | | ParseRules(); |
80 | | |
81 | | //////////////////////////// |
82 | | // whitespace definitions // |
83 | | //////////////////////////// |
84 | | |
85 | | enum { |
86 | | CHAR_SP = 32, /* space */ |
87 | | CHAR_HT = 9, /* horizontal tab */ |
88 | | CHAR_LF = 10, /* line feed */ |
89 | | CHAR_VT = 11, /* vertical tab */ |
90 | | CHAR_NP = 12, /* new page */ |
91 | | CHAR_CR = 13 /* carriage return */ |
92 | | }; |
93 | | |
94 | | ///////////////////// |
95 | | // character tests // |
96 | | ///////////////////// |
97 | | |
98 | | static CTypeResult is_type(char c, uint32_t bit); |
99 | | |
100 | | static CTypeResult is_char(char c); // ASCII 0-127 |
101 | | static CTypeResult is_upalpha(char c); // A-Z |
102 | | static CTypeResult is_loalpha(char c); // a-z |
103 | | static CTypeResult is_alpha(char c); // A-Z,a-z |
104 | | static CTypeResult is_digit(char c); // 0-9 |
105 | | static CTypeResult is_ctl(char c); // ASCII 0-31,127 (includes ws) |
106 | | static CTypeResult is_hex(char c); // 0-9,A-F,a-f |
107 | | static CTypeResult is_ws(char c); // SP,HT |
108 | | static CTypeResult is_cr(char c); // CR |
109 | | static CTypeResult is_lf(char c); // LF |
110 | | static CTypeResult is_spcr(char c); // SP,CR |
111 | | static CTypeResult is_splf(char c); // SP,LF |
112 | | static CTypeResult is_wslfcr(char c); // SP,HT,LF,CR |
113 | | static CTypeResult is_tspecials(char c); // HTTP chars that need quoting |
114 | | static CTypeResult is_token(char c); // token (not CTL or specials) |
115 | | static CTypeResult is_extra(char c); // !,*,QUOT,(,),COMMA |
116 | | static CTypeResult is_safe(char c); // [$-_.+] |
117 | | static CTypeResult is_unsafe(char c); // SP,DBLQUOT,#,%,<,> |
118 | | static CTypeResult is_national(char c); // {,},|,BACKSLASH,^,~,[,],` |
119 | | static CTypeResult is_reserved(char c); // :,/,?,:,@,&,= |
120 | | static CTypeResult is_unreserved(char c); // alpha,digit,safe,extra,nat. |
121 | | static CTypeResult is_punct(char c); // !"#$%&'()*+,-./:;<>=?@_{}|~ |
122 | | static CTypeResult is_end_of_url(char c); // NUL,CR,SP |
123 | | static CTypeResult is_eow(char c); // NUL,CR,LF |
124 | | static CTypeResult is_uri(char c); // A-Z,a-z,0-9 :/?#[]@!$&'()*+,;=-._~% |
125 | | static CTypeResult is_sep(char c); // nullptr,COMMA,':','!',wslfcr |
126 | | static CTypeResult is_empty(char c); // wslfcr,# |
127 | | static CTypeResult is_alnum(char c); // 0-9,A-Z,a-z |
128 | | static CTypeResult is_space(char c); // ' ' HT,VT,NP,CR,LF |
129 | | static CTypeResult is_control(char c); // 0x00-0x08, 0x0a-0x1f, 0x7f |
130 | | static CTypeResult is_mime_sep(char c); // @()<>,;\"/[]?{} \t |
131 | | static CTypeResult is_http_field_name(char c); // not :, =, 0x80+, control, or mime_sep except for @ |
132 | | static CTypeResult is_http_field_value(char c); // not CR, LF, comma, or " |
133 | | |
134 | | ////////////////// |
135 | | // string tests // |
136 | | ////////////////// |
137 | | |
138 | | static CTypeResult is_escape(const char *seq); // %<hex><hex> |
139 | | static CTypeResult is_uchar(const char *seq); // starts unreserved or is escape |
140 | | static CTypeResult is_pchar(const char *seq); // uchar,:,@,&,=,+ (see code) |
141 | | |
142 | | /////////////////// |
143 | | // unimplemented // |
144 | | /////////////////// |
145 | | |
146 | | // static CTypeResult is_comment(const char * str); |
147 | | // static CTypeResult is_ctext(const char * str); |
148 | | |
149 | | //////////////// |
150 | | // operations // |
151 | | //////////////// |
152 | | |
153 | | static CTypeResult strncasecmp_eow(const char *s1, const char *s2, int n); |
154 | | static const char *strcasestr(const char *s1, const char *s2); |
155 | | static int strlen_eow(const char *s); |
156 | | static const char *strstr_eow(const char *s1, const char *s2); |
157 | | |
158 | | static char ink_toupper(char c); |
159 | | static char ink_tolower(char c); |
160 | | static const char *memchr(const char *s, char c, int max_length); |
161 | | static const char *strchr(const char *s, char c); |
162 | | |
163 | | // noncopyable |
164 | | ParseRules(const ParseRules &) = delete; |
165 | | ParseRules &operator=(const ParseRules &) = delete; |
166 | | }; |
167 | | |
168 | | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
169 | | * inline functions definitions |
170 | | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
171 | | |
172 | | inline CTypeResult |
173 | | ParseRules::is_type(char c, uint32_t bitmask) |
174 | 0 | { |
175 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & bitmask); |
176 | 0 | } |
177 | | |
178 | | inline CTypeResult |
179 | | ParseRules::is_char(char c) |
180 | 0 | { |
181 | 0 | #ifndef COMPILE_PARSE_RULES |
182 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_char_BIT); |
183 | 0 | #else |
184 | 0 | return ((c & 0x80) == 0); |
185 | 0 | #endif |
186 | 0 | } |
187 | | |
188 | | inline CTypeResult |
189 | | ParseRules::is_upalpha(char c) |
190 | 0 | { |
191 | 0 | #ifndef COMPILE_PARSE_RULES |
192 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_upalpha_BIT); |
193 | | #else |
194 | | return (c >= 'A' && c <= 'Z'); |
195 | | #endif |
196 | 0 | } Unexecuted instantiation: ParseRules::is_upalpha(char) Unexecuted instantiation: ParseRules::is_upalpha(char) |
197 | | |
198 | | inline CTypeResult |
199 | | ParseRules::is_loalpha(char c) |
200 | 0 | { |
201 | 0 | #ifndef COMPILE_PARSE_RULES |
202 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_loalpha_BIT); |
203 | 0 | #else |
204 | 0 | return (c >= 'a' && c <= 'z'); |
205 | 0 | #endif |
206 | 0 | } |
207 | | |
208 | | inline CTypeResult |
209 | | ParseRules::is_alpha(char c) |
210 | 254 | { |
211 | 254 | #ifndef COMPILE_PARSE_RULES |
212 | 254 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_alpha_BIT); |
213 | | #else |
214 | | return (is_upalpha(c) || is_loalpha(c)); |
215 | | #endif |
216 | 254 | } |
217 | | |
218 | | inline CTypeResult |
219 | | ParseRules::is_digit(char c) |
220 | 4.93k | { |
221 | 4.93k | #ifndef COMPILE_PARSE_RULES |
222 | 4.93k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_digit_BIT); |
223 | | #else |
224 | | return (c >= '0' && c <= '9'); |
225 | | #endif |
226 | 4.93k | } |
227 | | |
228 | | inline CTypeResult |
229 | | ParseRules::is_alnum(char c) |
230 | 19.4k | { |
231 | 19.4k | #ifndef COMPILE_PARSE_RULES |
232 | 19.4k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_alnum_BIT); |
233 | | #else |
234 | | return (is_alpha(c) || is_digit(c)); |
235 | | #endif |
236 | 19.4k | } |
237 | | |
238 | | inline CTypeResult |
239 | | ParseRules::is_ctl(char c) |
240 | 0 | { |
241 | 0 | #ifndef COMPILE_PARSE_RULES |
242 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_ctl_BIT); |
243 | 0 | #else |
244 | 0 | return ((!(c & 0x80) && c <= 31) || c == 127); |
245 | 0 | #endif |
246 | 0 | } |
247 | | |
248 | | inline CTypeResult |
249 | | ParseRules::is_ws(char c) |
250 | 84.7k | { |
251 | 84.7k | #ifndef COMPILE_PARSE_RULES |
252 | 84.7k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_ws_BIT); |
253 | | #else |
254 | | return (c == CHAR_SP || c == CHAR_HT); |
255 | | #endif |
256 | 84.7k | } |
257 | | |
258 | | inline CTypeResult |
259 | | ParseRules::is_hex(char c) |
260 | 6 | { |
261 | 6 | #ifndef COMPILE_PARSE_RULES |
262 | 6 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_hex_BIT); |
263 | | #else |
264 | | return ((c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9')); |
265 | | #endif |
266 | 6 | } |
267 | | |
268 | | inline CTypeResult |
269 | | ParseRules::is_cr(char c) |
270 | 36.3k | { |
271 | 36.3k | return (c == CHAR_CR); |
272 | 36.3k | } |
273 | | |
274 | | inline CTypeResult |
275 | | ParseRules::is_lf(char c) |
276 | 36.4k | { |
277 | 36.4k | return (c == CHAR_LF); |
278 | 36.4k | } |
279 | | |
280 | | inline CTypeResult |
281 | | ParseRules::is_splf(char c) |
282 | 0 | { |
283 | 0 | #ifndef COMPILE_PARSE_RULES |
284 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_splf_BIT); |
285 | 0 | #else |
286 | 0 | return (c == CHAR_SP || c == CHAR_LF); |
287 | 0 | #endif |
288 | 0 | } |
289 | | |
290 | | inline CTypeResult |
291 | | ParseRules::is_spcr(char c) |
292 | 0 | { |
293 | 0 | #ifndef COMPILE_PARSE_RULES |
294 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_spcr_BIT); |
295 | 0 | #else |
296 | 0 | return (c == CHAR_SP || c == CHAR_CR); |
297 | 0 | #endif |
298 | 0 | } |
299 | | |
300 | | inline CTypeResult |
301 | | ParseRules::is_wslfcr(char c) |
302 | 27.9k | { |
303 | 27.9k | #ifndef COMPILE_PARSE_RULES |
304 | 27.9k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_wslfcr_BIT); |
305 | | #else |
306 | | return ParseRules::is_ws(c) || ParseRules::is_splf(c) || ParseRules::is_spcr(c); |
307 | | #endif |
308 | 27.9k | } |
309 | | |
310 | | inline CTypeResult |
311 | | ParseRules::is_extra(char c) |
312 | 0 | { |
313 | 0 | #ifndef COMPILE_PARSE_RULES |
314 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_extra_BIT); |
315 | 0 | #else |
316 | 0 | switch (c) { |
317 | 0 | case '!': |
318 | 0 | case '*': |
319 | 0 | case '\'': |
320 | 0 | case '(': |
321 | 0 | case ')': |
322 | 0 | case ',': |
323 | 0 | return (true); |
324 | 0 | } |
325 | 0 | return (false); |
326 | 0 | #endif |
327 | 0 | } |
328 | | |
329 | | inline CTypeResult |
330 | | ParseRules::is_safe(char c) |
331 | 0 | { |
332 | 0 | #ifndef COMPILE_PARSE_RULES |
333 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_safe_BIT); |
334 | 0 | #else |
335 | 0 | return (c == '$' || c == '-' || c == '_' || c == '.' || c == '+'); |
336 | 0 | #endif |
337 | 0 | } |
338 | | |
339 | | inline CTypeResult |
340 | | ParseRules::is_unsafe(char c) |
341 | 0 | { |
342 | 0 | #ifndef COMPILE_PARSE_RULES |
343 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_unsafe_BIT); |
344 | 0 | #else |
345 | 0 | if (is_ctl(c)) { |
346 | 0 | return (true); |
347 | 0 | } |
348 | 0 |
|
349 | 0 | switch (c) { |
350 | 0 | case ' ': |
351 | 0 | case '\"': |
352 | 0 | case '#': |
353 | 0 | case '%': |
354 | 0 | case '<': |
355 | 0 | case '>': |
356 | 0 | return (true); |
357 | 0 | } |
358 | 0 | return (false); |
359 | 0 | #endif |
360 | 0 | } |
361 | | |
362 | | inline CTypeResult |
363 | | ParseRules::is_reserved(char c) |
364 | 0 | { |
365 | 0 | #ifndef COMPILE_PARSE_RULES |
366 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_reserved_BIT); |
367 | 0 | #else |
368 | 0 | switch (c) { |
369 | 0 | case ';': |
370 | 0 | case '/': |
371 | 0 | case '?': |
372 | 0 | case ':': |
373 | 0 | case '@': |
374 | 0 | case '&': |
375 | 0 | case '=': |
376 | 0 | return (true); |
377 | 0 | } |
378 | 0 | return (false); |
379 | 0 | #endif |
380 | 0 | } |
381 | | |
382 | | inline CTypeResult |
383 | | ParseRules::is_national(char c) |
384 | 0 | { |
385 | 0 | #ifndef COMPILE_PARSE_RULES |
386 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_national_BIT); |
387 | 0 | #else |
388 | 0 | switch (c) { |
389 | 0 | case '{': |
390 | 0 | case '}': |
391 | 0 | case '|': |
392 | 0 | case '\\': |
393 | 0 | case '^': |
394 | 0 | case '~': |
395 | 0 | case '[': |
396 | 0 | case ']': |
397 | 0 | case '`': |
398 | 0 | return (true); |
399 | 0 | } |
400 | 0 | return (false); |
401 | 0 | #endif |
402 | 0 | } |
403 | | |
404 | | inline CTypeResult |
405 | | ParseRules::is_unreserved(char c) |
406 | 0 | { |
407 | 0 | #ifndef COMPILE_PARSE_RULES |
408 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_unreserved_BIT); |
409 | 0 | #else |
410 | 0 | return (is_alpha(c) || is_digit(c) || is_safe(c) || is_extra(c) || is_national(c)); |
411 | 0 | #endif |
412 | 0 | } |
413 | | |
414 | | inline CTypeResult |
415 | | ParseRules::is_punct(char c) |
416 | 0 | { |
417 | 0 | #ifndef COMPILE_PARSE_RULES |
418 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_punct_BIT); |
419 | 0 | #else |
420 | 0 | switch (c) { |
421 | 0 | case '!': |
422 | 0 | case '"': |
423 | 0 | case '#': |
424 | 0 | case '%': |
425 | 0 | case '&': |
426 | 0 | case '\'': |
427 | 0 | case '(': |
428 | 0 | case ')': |
429 | 0 | case '*': |
430 | 0 | case '+': |
431 | 0 | case ',': |
432 | 0 | case '-': |
433 | 0 | case '.': |
434 | 0 | case '/': |
435 | 0 | case ':': |
436 | 0 | case ';': |
437 | 0 | case '<': |
438 | 0 | case '=': |
439 | 0 | case '>': |
440 | 0 | case '?': |
441 | 0 | case '@': |
442 | 0 | case '[': |
443 | 0 | case '\\': |
444 | 0 | case ']': |
445 | 0 | case '^': |
446 | 0 | case '_': |
447 | 0 | case '`': |
448 | 0 | case '{': |
449 | 0 | case '|': |
450 | 0 | case '}': |
451 | 0 | case '~': |
452 | 0 | return (true); |
453 | 0 | } |
454 | 0 | return (false); |
455 | 0 | #endif |
456 | 0 | } |
457 | | |
458 | | inline CTypeResult |
459 | | ParseRules::is_end_of_url(char c) |
460 | 0 | { |
461 | 0 | #ifndef COMPILE_PARSE_RULES |
462 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_end_of_url_BIT); |
463 | 0 | #else |
464 | 0 | return (c == '\0' || c == '\n' || c == ' ' || ParseRules::is_ctl(c)); |
465 | 0 | #endif |
466 | 0 | } |
467 | | |
468 | | inline CTypeResult |
469 | | ParseRules::is_escape(const char *seq) |
470 | 0 | { |
471 | 0 | return (seq[0] == '%' && is_hex(seq[1]) && is_hex(seq[2])); |
472 | 0 | } |
473 | | |
474 | | inline CTypeResult |
475 | | ParseRules::is_uchar(const char *seq) |
476 | 0 | { |
477 | 0 | return (is_unreserved(seq[0]) || is_escape(seq)); |
478 | 0 | } |
479 | | |
480 | | // |
481 | | // have to cheat on this one |
482 | | // |
483 | | inline CTypeResult |
484 | | ParseRules::is_pchar(const char *seq) |
485 | 0 | { |
486 | 0 | #ifndef COMPILE_PARSE_RULES |
487 | 0 | if (*seq != '%') { |
488 | 0 | return (parseRulesCType[static_cast<uint8_t>(*seq)] & is_pchar_BIT); |
489 | 0 | } else { |
490 | 0 | return is_hex(seq[1]) && is_hex(seq[2]); |
491 | 0 | } |
492 | 0 | #else |
493 | 0 | if (is_unreserved(*seq)) { |
494 | 0 | return (true); |
495 | 0 | } |
496 | 0 |
|
497 | 0 | switch (seq[0]) { |
498 | 0 | case ':': |
499 | 0 | case '@': |
500 | 0 | case '&': |
501 | 0 | case '=': |
502 | 0 | case '+': |
503 | 0 | return (true); |
504 | 0 | } |
505 | 0 | return (false); |
506 | 0 | #endif |
507 | 0 | } |
508 | | |
509 | | inline CTypeResult |
510 | | ParseRules::is_tspecials(char c) |
511 | 0 | { |
512 | 0 | #ifndef COMPILE_PARSE_RULES |
513 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_tspecials_BIT); |
514 | 0 | #else |
515 | 0 | switch (c) { |
516 | 0 | case '(': |
517 | 0 | case ')': |
518 | 0 | case '<': |
519 | 0 | case '>': |
520 | 0 | case '@': |
521 | 0 | case ',': |
522 | 0 | case ';': |
523 | 0 | case ':': |
524 | 0 | case '\\': |
525 | 0 | case '"': |
526 | 0 | case '/': |
527 | 0 | case '[': |
528 | 0 | case ']': |
529 | 0 | case '?': |
530 | 0 | case '=': |
531 | 0 | case '{': |
532 | 0 | case '}': |
533 | 0 | case CHAR_SP: |
534 | 0 | case CHAR_HT: |
535 | 0 | return (true); |
536 | 0 | } |
537 | 0 | return (false); |
538 | 0 | #endif |
539 | 0 | } |
540 | | |
541 | | inline CTypeResult |
542 | | ParseRules::is_token(char c) |
543 | 42.7k | { |
544 | 42.7k | #ifndef COMPILE_PARSE_RULES |
545 | 42.7k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_token_BIT); |
546 | | #else |
547 | | return (is_char(c) && !(is_ctl(c) || is_tspecials(c))); |
548 | | #endif |
549 | 42.7k | } |
550 | | |
551 | | inline char |
552 | | ParseRules::ink_toupper(char c) |
553 | 19.6k | { |
554 | 19.6k | #ifndef COMPILE_PARSE_RULES |
555 | 19.6k | return parseRulesCTypeToUpper[static_cast<unsigned char>(c)]; |
556 | | #else |
557 | | int up_case = c; |
558 | | const int up_case_diff = 'a' - 'A'; |
559 | | |
560 | | if (c >= 'a' && c <= 'z') { |
561 | | up_case = c - up_case_diff; |
562 | | } |
563 | | return (up_case); |
564 | | #endif |
565 | 19.6k | } |
566 | | |
567 | | inline char |
568 | | ParseRules::ink_tolower(char c) |
569 | 1.31k | { |
570 | 1.31k | #ifndef COMPILE_PARSE_RULES |
571 | 1.31k | return parseRulesCTypeToLower[static_cast<unsigned char>(c)]; |
572 | | #else |
573 | | int lo_case = c; |
574 | | const int lo_case_diff = 'a' - 'A'; |
575 | | |
576 | | if (c >= 'A' && c <= 'Z') { |
577 | | lo_case = c + lo_case_diff; |
578 | | } |
579 | | return (lo_case); |
580 | | #endif |
581 | 1.31k | } |
582 | | |
583 | | inline CTypeResult |
584 | | ParseRules::is_eow(char c) |
585 | 0 | { |
586 | 0 | #ifndef COMPILE_PARSE_RULES |
587 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_eow_BIT); |
588 | | #else |
589 | | return (c == '\0' || c == '\r' || c == '\n'); |
590 | | #endif |
591 | 0 | } Unexecuted instantiation: ParseRules::is_eow(char) Unexecuted instantiation: ParseRules::is_eow(char) |
592 | | |
593 | | inline CTypeResult |
594 | | ParseRules::is_uri(char c) |
595 | 0 | { |
596 | 0 | #ifndef COMPILE_PARSE_RULES |
597 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_uri_BIT); |
598 | | #else |
599 | | if (is_alnum(c)) { |
600 | | return (true); |
601 | | } |
602 | | |
603 | | switch (c) { |
604 | | case ':': |
605 | | case '/': |
606 | | case '?': |
607 | | case '#': |
608 | | case '[': |
609 | | case ']': |
610 | | case '@': |
611 | | case '!': |
612 | | case '$': |
613 | | case '&': |
614 | | case '\'': |
615 | | case '(': |
616 | | case ')': |
617 | | case '*': |
618 | | case '+': |
619 | | case ',': |
620 | | case ';': |
621 | | case '=': |
622 | | case '-': |
623 | | case '.': |
624 | | case '_': |
625 | | case '~': |
626 | | case '%': |
627 | | return (true); |
628 | | } |
629 | | return (false); |
630 | | #endif |
631 | 0 | } Unexecuted instantiation: ParseRules::is_uri(char) Unexecuted instantiation: ParseRules::is_uri(char) |
632 | | |
633 | | inline CTypeResult |
634 | | ParseRules::is_sep(char c) |
635 | 0 | { |
636 | 0 | #ifndef COMPILE_PARSE_RULES |
637 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_sep_BIT); |
638 | 0 | #else |
639 | 0 | return (!c || c == ',' || c == ':' || c == '!' || is_wslfcr(c)); |
640 | 0 | #endif |
641 | 0 | } |
642 | | |
643 | | inline CTypeResult |
644 | | ParseRules::is_empty(char c) |
645 | 0 | { |
646 | 0 | #ifndef COMPILE_PARSE_RULES |
647 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_empty_BIT); |
648 | 0 | #else |
649 | 0 | return (c == '#' || is_wslfcr(c)); |
650 | 0 | #endif |
651 | 0 | } |
652 | | |
653 | | inline CTypeResult |
654 | | ParseRules::is_space(char c) |
655 | 751 | { |
656 | 751 | #ifndef COMPILE_PARSE_RULES |
657 | 751 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_space_BIT); |
658 | | #else |
659 | | switch (c) { |
660 | | case CHAR_SP: |
661 | | case CHAR_HT: |
662 | | case CHAR_LF: |
663 | | case CHAR_VT: |
664 | | case CHAR_NP: |
665 | | case CHAR_CR: |
666 | | return (true); |
667 | | } |
668 | | return (false); |
669 | | #endif |
670 | 751 | } |
671 | | |
672 | | /** |
673 | | Return true if @c is a control char except HTAB(0x09) and SP(0x20). |
674 | | If you need to check @c is HTAB or SP, use `ParseRules::is_ws`. |
675 | | */ |
676 | | inline CTypeResult |
677 | | ParseRules::is_control(char c) |
678 | 46.2k | { |
679 | 46.2k | #ifndef COMPILE_PARSE_RULES |
680 | 46.2k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_control_BIT); |
681 | | #else |
682 | | if (c == CHAR_HT || c == CHAR_SP) { |
683 | | return false; |
684 | | } |
685 | | |
686 | | if ((static_cast<unsigned char>(c)) < 0x20 || c == 0x7f) { |
687 | | return true; |
688 | | } |
689 | | |
690 | | return false; |
691 | | #endif |
692 | 46.2k | } |
693 | | |
694 | | inline CTypeResult |
695 | | ParseRules::is_mime_sep(char c) |
696 | 0 | { |
697 | 0 | #ifndef COMPILE_PARSE_RULES |
698 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_mime_sep_BIT); |
699 | 0 | #else |
700 | 0 | if ((c == '(') || (c == ')') || (c == '<') || (c == '>') || (c == '@') || (c == ',') || (c == ';') || (c == '\\') || |
701 | 0 | (c == '\"') || (c == '/') || (c == '[') || (c == ']') || (c == '?') || (c == '{') || (c == '}') || (c == ' ') || |
702 | 0 | (c == '\t')) { |
703 | 0 | return true; |
704 | 0 | } |
705 | 0 | return false; |
706 | 0 | #endif |
707 | 0 | } |
708 | | |
709 | | inline CTypeResult |
710 | | ParseRules::is_http_field_name(char c) |
711 | 22.0k | { |
712 | 22.0k | #ifndef COMPILE_PARSE_RULES |
713 | 22.0k | return (parseRulesCType[static_cast<unsigned char>(c)] & is_http_field_name_BIT); |
714 | | #else |
715 | | if (!is_char(c) || is_control(c) || (is_mime_sep(c) && c != '@') || c == '=' || c == ':') { |
716 | | return false; |
717 | | } |
718 | | return true; |
719 | | #endif |
720 | 22.0k | } |
721 | | |
722 | | inline CTypeResult |
723 | | ParseRules::is_http_field_value(char c) |
724 | 0 | { |
725 | 0 | #ifndef COMPILE_PARSE_RULES |
726 | 0 | return (parseRulesCType[static_cast<unsigned char>(c)] & is_http_field_value_BIT); |
727 | 0 | #else |
728 | 0 | switch (c) { |
729 | 0 | case CHAR_CR: |
730 | 0 | case CHAR_LF: |
731 | 0 | case '\"': |
732 | 0 | case ',': |
733 | 0 | return false; |
734 | 0 | } |
735 | 0 | return true; |
736 | 0 | #endif |
737 | 0 | } |
738 | | |
739 | | ////////////////////////////////////////////////////////////////////////////// |
740 | | // |
741 | | // inline CTypeResult ParseRules::strncasecmp_eol(s1, s2, count) |
742 | | // |
743 | | // This wacky little function compares if two strings <s1> and <s2> match |
744 | | // (case-insensitively) up to <count> characters long, stopping not only |
745 | | // at the end of string ('\0'), but also at end of line (CR or LF). |
746 | | // |
747 | | ////////////////////////////////////////////////////////////////////////////// |
748 | | |
749 | | inline CTypeResult |
750 | | ParseRules::strncasecmp_eow(const char *s1, const char *s2, int count) |
751 | 0 | { |
752 | 0 | for (int i = 0; i < count; i++) { |
753 | 0 | const char &a = s1[i]; |
754 | 0 | const char &b = s2[i]; |
755 | 0 |
|
756 | 0 | /////////////////////////////////////////////////////////////// |
757 | 0 | // if they are different; only match if both are terminators // |
758 | 0 | /////////////////////////////////////////////////////////////// |
759 | 0 | if (ink_tolower(a) != ink_tolower(b)) { |
760 | 0 | return (is_eow(a) && is_eow(b)); |
761 | 0 | } |
762 | 0 | } |
763 | 0 | return (true); |
764 | 0 | } |
765 | | |
766 | | ////////////////////////////////////////////////////////////////////////////// |
767 | | // |
768 | | // strlen_eow() |
769 | | // |
770 | | // return the length of a string |
771 | | ////////////////////////////////////////////////////////////////////////////// |
772 | | inline int |
773 | | ParseRules::strlen_eow(const char *s) |
774 | 0 | { |
775 | 0 | for (int i = 0; true; i++) { |
776 | 0 | if (is_eow(s[i])) { |
777 | 0 | return (i); |
778 | 0 | } |
779 | 0 | } |
780 | 0 | } |
781 | | |
782 | | ////////////////////////////////////////////////////////////////////////////// |
783 | | // |
784 | | // strstr_eow() |
785 | | // |
786 | | // This function is the same as strstr(), except that it accepts strings |
787 | | // that are terminated with '\r', '\n' or null. |
788 | | // It returns a pointer to the first occurrence of s2 within s1 (or null). |
789 | | ////////////////////////////////////////////////////////////////////////////// |
790 | | inline const char * |
791 | | ParseRules::strstr_eow(const char *s1, const char *s2) |
792 | 0 | { |
793 | 0 | int i1; |
794 | 0 |
|
795 | 0 | int s2_len = strlen_eow(s2); |
796 | 0 |
|
797 | 0 | for (i1 = 0; !is_eow(s1[i1]); i1++) { |
798 | 0 | if (ink_tolower(s1[i1]) == ink_tolower(s2[0])) { |
799 | 0 | if (strncasecmp_eow(&s1[i1], &s2[0], s2_len)) { |
800 | 0 | return (&s1[i1]); |
801 | 0 | } |
802 | 0 | } |
803 | 0 | } |
804 | 0 |
|
805 | 0 | return (nullptr); |
806 | 0 | } |
807 | | |
808 | | inline const char * |
809 | | ParseRules::strcasestr(const char *s1, const char *s2) |
810 | 0 | { |
811 | 0 | int i1; |
812 | 0 |
|
813 | 0 | size_t s2_len = strlen(s2); |
814 | 0 |
|
815 | 0 | for (i1 = 0; s1[i1] != '\0'; i1++) { |
816 | 0 | if (ink_tolower(s1[i1]) == ink_tolower(s2[0])) { |
817 | 0 | if (strncasecmp_eow(&s1[i1], &s2[0], static_cast<int>(s2_len))) { |
818 | 0 | return (&s1[i1]); |
819 | 0 | } |
820 | 0 | } |
821 | 0 | } |
822 | 0 |
|
823 | 0 | return (nullptr); |
824 | 0 | } |
825 | | |
826 | | inline const char * |
827 | | ParseRules::memchr(const char *s, char c, int max_length) |
828 | 0 | { |
829 | 0 | for (int i = 0; i < max_length; i++) { |
830 | 0 | if (s[i] == c) { |
831 | 0 | return (&s[i]); |
832 | 0 | } |
833 | 0 | } |
834 | 0 | return (nullptr); |
835 | 0 | } |
836 | | |
837 | | inline const char * |
838 | | ParseRules::strchr(const char *s, char c) |
839 | 0 | { |
840 | 0 | for (int i = 0; s[i] != '\0'; i++) { |
841 | 0 | if (s[i] == c) { |
842 | 0 | return (&s[i]); |
843 | 0 | } |
844 | 0 | } |
845 | 0 | return (nullptr); |
846 | 0 | } |
847 | | |
848 | | static inline int |
849 | | ink_get_hex(char c) |
850 | 6 | { |
851 | 6 | if (ParseRules::is_digit(c)) { |
852 | 6 | return (c - '0'); |
853 | 6 | } |
854 | 0 | c = ParseRules::ink_tolower(c); |
855 | 0 | return ((c - 'a') + 10); |
856 | 6 | } Unexecuted instantiation: fuzz_http3frame.cc:ink_get_hex(char) Unexecuted instantiation: Layout.cc:ink_get_hex(char) Unexecuted instantiation: ink_args.cc:ink_get_hex(char) ParseRules.cc:ink_get_hex(char) Line | Count | Source | 850 | 6 | { | 851 | 6 | if (ParseRules::is_digit(c)) { | 852 | 6 | return (c - '0'); | 853 | 6 | } | 854 | 0 | c = ParseRules::ink_tolower(c); | 855 | 0 | return ((c - 'a') + 10); | 856 | 6 | } |
Unexecuted instantiation: ink_file.cc:ink_get_hex(char) Unexecuted instantiation: ink_memory.cc:ink_get_hex(char) Unexecuted instantiation: Http3Config.cc:ink_get_hex(char) Unexecuted instantiation: Http3Frame.cc:ink_get_hex(char) Unexecuted instantiation: ink_queue.cc:ink_get_hex(char) Unexecuted instantiation: hugepages.cc:ink_get_hex(char) Unexecuted instantiation: JeMiAllocator.cc:ink_get_hex(char) Unexecuted instantiation: EventSystem.cc:ink_get_hex(char) Unexecuted instantiation: LogMessage.cc:ink_get_hex(char) Unexecuted instantiation: Diags.cc:ink_get_hex(char) Unexecuted instantiation: BaseLogFile.cc:ink_get_hex(char) Unexecuted instantiation: ink_time.cc:ink_get_hex(char) Unexecuted instantiation: ink_cap.cc:ink_get_hex(char) Unexecuted instantiation: ink_sock.cc:ink_get_hex(char) Unexecuted instantiation: IOBuffer.cc:ink_get_hex(char) Unexecuted instantiation: Thread.cc:ink_get_hex(char) Unexecuted instantiation: Lock.cc:ink_get_hex(char) Unexecuted instantiation: UnixEThread.cc:ink_get_hex(char) Unexecuted instantiation: PQ-List.cc:ink_get_hex(char) Unexecuted instantiation: ProtectedQueue.cc:ink_get_hex(char) Unexecuted instantiation: UnixEvent.cc:ink_get_hex(char) Unexecuted instantiation: UnixEventProcessor.cc:ink_get_hex(char) Unexecuted instantiation: ConfigProcessor.cc:ink_get_hex(char) Unexecuted instantiation: Version.cc:ink_get_hex(char) Unexecuted instantiation: RecProcess.cc:ink_get_hex(char) Unexecuted instantiation: RecRawStatsImpl.cc:ink_get_hex(char) Unexecuted instantiation: Tasks.cc:ink_get_hex(char) Unexecuted instantiation: P_RecCore.cc:ink_get_hex(char) Unexecuted instantiation: RecConfigParse.cc:ink_get_hex(char) Unexecuted instantiation: RecCore.cc:ink_get_hex(char) Unexecuted instantiation: RecDebug.cc:ink_get_hex(char) Unexecuted instantiation: RecFile.cc:ink_get_hex(char) Unexecuted instantiation: RecMessage.cc:ink_get_hex(char) Unexecuted instantiation: RecUtils.cc:ink_get_hex(char) Unexecuted instantiation: RecYAMLDecoder.cc:ink_get_hex(char) Unexecuted instantiation: RecordsConfigUtils.cc:ink_get_hex(char) Unexecuted instantiation: RecRawStats.cc:ink_get_hex(char) Unexecuted instantiation: ConfigContext.cc:ink_get_hex(char) Unexecuted instantiation: ConfigReloadTrace.cc:ink_get_hex(char) Unexecuted instantiation: ReloadCoordinator.cc:ink_get_hex(char) Unexecuted instantiation: fuzz_json.cc:ink_get_hex(char) Unexecuted instantiation: JsonRPCManager.cc:ink_get_hex(char) Unexecuted instantiation: fuzz_hpack.cc:ink_get_hex(char) Unexecuted instantiation: HTTP2.cc:ink_get_hex(char) Unexecuted instantiation: Http2Frame.cc:ink_get_hex(char) Unexecuted instantiation: HPACK.cc:ink_get_hex(char) Unexecuted instantiation: HTTP.cc:ink_get_hex(char) Unexecuted instantiation: HdrHeap.cc:ink_get_hex(char) Unexecuted instantiation: HdrToken.cc:ink_get_hex(char) Unexecuted instantiation: MIME.cc:ink_get_hex(char) Unexecuted instantiation: HdrUtils.cc:ink_get_hex(char) Unexecuted instantiation: HttpCompat.cc:ink_get_hex(char) Unexecuted instantiation: URL.cc:ink_get_hex(char) Unexecuted instantiation: VersionConverter.cc:ink_get_hex(char) Unexecuted instantiation: XPACK.cc:ink_get_hex(char) Unexecuted instantiation: HeaderValidator.cc:ink_get_hex(char) Unexecuted instantiation: fuzz_proxy_protocol.cc:ink_get_hex(char) Unexecuted instantiation: ProxyProtocol.cc:ink_get_hex(char) Unexecuted instantiation: ink_inet.cc:ink_get_hex(char) Unexecuted instantiation: fuzz_http.cc:ink_get_hex(char) Unexecuted instantiation: fuzz_rec_http.cc:ink_get_hex(char) Unexecuted instantiation: RecHttp.cc:ink_get_hex(char) Unexecuted instantiation: ink_res_init.cc:ink_get_hex(char) |
857 | | |
858 | | int64_t ink_atoi64(const char *, const char **end = nullptr); |
859 | | uint64_t ink_atoui64(const char *); |
860 | | int64_t ink_atoi64(const char *, int); |
861 | | |
862 | | static inline int |
863 | | ink_atoi(const char *str) |
864 | 0 | { |
865 | 0 | int64_t val = ink_atoi64(str); |
866 | 0 |
|
867 | 0 | if (val > INT_MAX) { |
868 | 0 | return INT_MAX; |
869 | 0 | } else if (val < INT_MIN) { |
870 | 0 | return INT_MIN; |
871 | 0 | } else { |
872 | 0 | return static_cast<int>(val); |
873 | 0 | } |
874 | 0 | } Unexecuted instantiation: fuzz_http3frame.cc:ink_atoi(char const*) Unexecuted instantiation: Layout.cc:ink_atoi(char const*) Unexecuted instantiation: ink_args.cc:ink_atoi(char const*) Unexecuted instantiation: ParseRules.cc:ink_atoi(char const*) Unexecuted instantiation: ink_file.cc:ink_atoi(char const*) Unexecuted instantiation: ink_memory.cc:ink_atoi(char const*) Unexecuted instantiation: Http3Config.cc:ink_atoi(char const*) Unexecuted instantiation: Http3Frame.cc:ink_atoi(char const*) Unexecuted instantiation: ink_queue.cc:ink_atoi(char const*) Unexecuted instantiation: hugepages.cc:ink_atoi(char const*) Unexecuted instantiation: JeMiAllocator.cc:ink_atoi(char const*) Unexecuted instantiation: EventSystem.cc:ink_atoi(char const*) Unexecuted instantiation: LogMessage.cc:ink_atoi(char const*) Unexecuted instantiation: Diags.cc:ink_atoi(char const*) Unexecuted instantiation: BaseLogFile.cc:ink_atoi(char const*) Unexecuted instantiation: ink_time.cc:ink_atoi(char const*) Unexecuted instantiation: ink_cap.cc:ink_atoi(char const*) Unexecuted instantiation: ink_sock.cc:ink_atoi(char const*) Unexecuted instantiation: IOBuffer.cc:ink_atoi(char const*) Unexecuted instantiation: Thread.cc:ink_atoi(char const*) Unexecuted instantiation: Lock.cc:ink_atoi(char const*) Unexecuted instantiation: UnixEThread.cc:ink_atoi(char const*) Unexecuted instantiation: PQ-List.cc:ink_atoi(char const*) Unexecuted instantiation: ProtectedQueue.cc:ink_atoi(char const*) Unexecuted instantiation: UnixEvent.cc:ink_atoi(char const*) Unexecuted instantiation: UnixEventProcessor.cc:ink_atoi(char const*) Unexecuted instantiation: ConfigProcessor.cc:ink_atoi(char const*) Unexecuted instantiation: Version.cc:ink_atoi(char const*) Unexecuted instantiation: RecProcess.cc:ink_atoi(char const*) Unexecuted instantiation: RecRawStatsImpl.cc:ink_atoi(char const*) Unexecuted instantiation: Tasks.cc:ink_atoi(char const*) Unexecuted instantiation: P_RecCore.cc:ink_atoi(char const*) Unexecuted instantiation: RecConfigParse.cc:ink_atoi(char const*) Unexecuted instantiation: RecCore.cc:ink_atoi(char const*) Unexecuted instantiation: RecDebug.cc:ink_atoi(char const*) Unexecuted instantiation: RecFile.cc:ink_atoi(char const*) Unexecuted instantiation: RecMessage.cc:ink_atoi(char const*) Unexecuted instantiation: RecUtils.cc:ink_atoi(char const*) Unexecuted instantiation: RecYAMLDecoder.cc:ink_atoi(char const*) Unexecuted instantiation: RecordsConfigUtils.cc:ink_atoi(char const*) Unexecuted instantiation: RecRawStats.cc:ink_atoi(char const*) Unexecuted instantiation: ConfigContext.cc:ink_atoi(char const*) Unexecuted instantiation: ConfigReloadTrace.cc:ink_atoi(char const*) Unexecuted instantiation: ReloadCoordinator.cc:ink_atoi(char const*) Unexecuted instantiation: fuzz_json.cc:ink_atoi(char const*) Unexecuted instantiation: JsonRPCManager.cc:ink_atoi(char const*) Unexecuted instantiation: fuzz_hpack.cc:ink_atoi(char const*) Unexecuted instantiation: HTTP2.cc:ink_atoi(char const*) Unexecuted instantiation: Http2Frame.cc:ink_atoi(char const*) Unexecuted instantiation: HPACK.cc:ink_atoi(char const*) Unexecuted instantiation: HTTP.cc:ink_atoi(char const*) Unexecuted instantiation: HdrHeap.cc:ink_atoi(char const*) Unexecuted instantiation: HdrToken.cc:ink_atoi(char const*) Unexecuted instantiation: MIME.cc:ink_atoi(char const*) Unexecuted instantiation: HdrUtils.cc:ink_atoi(char const*) Unexecuted instantiation: HttpCompat.cc:ink_atoi(char const*) Unexecuted instantiation: URL.cc:ink_atoi(char const*) Unexecuted instantiation: VersionConverter.cc:ink_atoi(char const*) Unexecuted instantiation: XPACK.cc:ink_atoi(char const*) Unexecuted instantiation: HeaderValidator.cc:ink_atoi(char const*) Unexecuted instantiation: fuzz_proxy_protocol.cc:ink_atoi(char const*) Unexecuted instantiation: ProxyProtocol.cc:ink_atoi(char const*) Unexecuted instantiation: ink_inet.cc:ink_atoi(char const*) Unexecuted instantiation: fuzz_http.cc:ink_atoi(char const*) Unexecuted instantiation: fuzz_rec_http.cc:ink_atoi(char const*) Unexecuted instantiation: RecHttp.cc:ink_atoi(char const*) Unexecuted instantiation: ink_res_init.cc:ink_atoi(char const*) |
875 | | |
876 | | static inline int |
877 | | ink_atoi(const char *str, int len) |
878 | 44 | { |
879 | 44 | int64_t val = ink_atoi64(str, len); |
880 | | |
881 | 44 | if (val > INT_MAX) { |
882 | 0 | return INT_MAX; |
883 | 44 | } else if (val < INT_MIN) { |
884 | 0 | return INT_MIN; |
885 | 44 | } else { |
886 | 44 | return static_cast<int>(val); |
887 | 44 | } |
888 | 44 | } Unexecuted instantiation: fuzz_http3frame.cc:ink_atoi(char const*, int) Unexecuted instantiation: Layout.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_args.cc:ink_atoi(char const*, int) Unexecuted instantiation: ParseRules.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_file.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_memory.cc:ink_atoi(char const*, int) Unexecuted instantiation: Http3Config.cc:ink_atoi(char const*, int) Unexecuted instantiation: Http3Frame.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_queue.cc:ink_atoi(char const*, int) Unexecuted instantiation: hugepages.cc:ink_atoi(char const*, int) Unexecuted instantiation: JeMiAllocator.cc:ink_atoi(char const*, int) Unexecuted instantiation: EventSystem.cc:ink_atoi(char const*, int) Unexecuted instantiation: LogMessage.cc:ink_atoi(char const*, int) Unexecuted instantiation: Diags.cc:ink_atoi(char const*, int) Unexecuted instantiation: BaseLogFile.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_time.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_cap.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_sock.cc:ink_atoi(char const*, int) Unexecuted instantiation: IOBuffer.cc:ink_atoi(char const*, int) Unexecuted instantiation: Thread.cc:ink_atoi(char const*, int) Unexecuted instantiation: Lock.cc:ink_atoi(char const*, int) Unexecuted instantiation: UnixEThread.cc:ink_atoi(char const*, int) Unexecuted instantiation: PQ-List.cc:ink_atoi(char const*, int) Unexecuted instantiation: ProtectedQueue.cc:ink_atoi(char const*, int) Unexecuted instantiation: UnixEvent.cc:ink_atoi(char const*, int) Unexecuted instantiation: UnixEventProcessor.cc:ink_atoi(char const*, int) Unexecuted instantiation: ConfigProcessor.cc:ink_atoi(char const*, int) Unexecuted instantiation: Version.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecProcess.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecRawStatsImpl.cc:ink_atoi(char const*, int) Unexecuted instantiation: Tasks.cc:ink_atoi(char const*, int) Unexecuted instantiation: P_RecCore.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecConfigParse.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecCore.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecDebug.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecFile.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecMessage.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecUtils.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecYAMLDecoder.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecordsConfigUtils.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecRawStats.cc:ink_atoi(char const*, int) Unexecuted instantiation: ConfigContext.cc:ink_atoi(char const*, int) Unexecuted instantiation: ConfigReloadTrace.cc:ink_atoi(char const*, int) Unexecuted instantiation: ReloadCoordinator.cc:ink_atoi(char const*, int) Unexecuted instantiation: fuzz_json.cc:ink_atoi(char const*, int) Unexecuted instantiation: JsonRPCManager.cc:ink_atoi(char const*, int) Unexecuted instantiation: fuzz_hpack.cc:ink_atoi(char const*, int) Unexecuted instantiation: HTTP2.cc:ink_atoi(char const*, int) Unexecuted instantiation: Http2Frame.cc:ink_atoi(char const*, int) Unexecuted instantiation: HPACK.cc:ink_atoi(char const*, int) HTTP.cc:ink_atoi(char const*, int) Line | Count | Source | 878 | 44 | { | 879 | 44 | int64_t val = ink_atoi64(str, len); | 880 | | | 881 | 44 | if (val > INT_MAX) { | 882 | 0 | return INT_MAX; | 883 | 44 | } else if (val < INT_MIN) { | 884 | 0 | return INT_MIN; | 885 | 44 | } else { | 886 | 44 | return static_cast<int>(val); | 887 | 44 | } | 888 | 44 | } |
Unexecuted instantiation: HdrHeap.cc:ink_atoi(char const*, int) Unexecuted instantiation: HdrToken.cc:ink_atoi(char const*, int) Unexecuted instantiation: MIME.cc:ink_atoi(char const*, int) Unexecuted instantiation: HdrUtils.cc:ink_atoi(char const*, int) Unexecuted instantiation: HttpCompat.cc:ink_atoi(char const*, int) Unexecuted instantiation: URL.cc:ink_atoi(char const*, int) Unexecuted instantiation: VersionConverter.cc:ink_atoi(char const*, int) Unexecuted instantiation: XPACK.cc:ink_atoi(char const*, int) Unexecuted instantiation: HeaderValidator.cc:ink_atoi(char const*, int) Unexecuted instantiation: fuzz_proxy_protocol.cc:ink_atoi(char const*, int) Unexecuted instantiation: ProxyProtocol.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_inet.cc:ink_atoi(char const*, int) Unexecuted instantiation: fuzz_http.cc:ink_atoi(char const*, int) Unexecuted instantiation: fuzz_rec_http.cc:ink_atoi(char const*, int) Unexecuted instantiation: RecHttp.cc:ink_atoi(char const*, int) Unexecuted instantiation: ink_res_init.cc:ink_atoi(char const*, int) |
889 | | |
890 | | static inline unsigned int |
891 | | ink_atoui(const char *str) |
892 | 0 | { |
893 | 0 | uint64_t val = ink_atoui64(str); |
894 | 0 |
|
895 | 0 | if (val > UINT_MAX) { |
896 | 0 | return UINT_MAX; |
897 | 0 | } else { |
898 | 0 | return static_cast<unsigned int>(val); |
899 | 0 | } |
900 | 0 | } Unexecuted instantiation: fuzz_http3frame.cc:ink_atoui(char const*) Unexecuted instantiation: Layout.cc:ink_atoui(char const*) Unexecuted instantiation: ink_args.cc:ink_atoui(char const*) Unexecuted instantiation: ParseRules.cc:ink_atoui(char const*) Unexecuted instantiation: ink_file.cc:ink_atoui(char const*) Unexecuted instantiation: ink_memory.cc:ink_atoui(char const*) Unexecuted instantiation: Http3Config.cc:ink_atoui(char const*) Unexecuted instantiation: Http3Frame.cc:ink_atoui(char const*) Unexecuted instantiation: ink_queue.cc:ink_atoui(char const*) Unexecuted instantiation: hugepages.cc:ink_atoui(char const*) Unexecuted instantiation: JeMiAllocator.cc:ink_atoui(char const*) Unexecuted instantiation: EventSystem.cc:ink_atoui(char const*) Unexecuted instantiation: LogMessage.cc:ink_atoui(char const*) Unexecuted instantiation: Diags.cc:ink_atoui(char const*) Unexecuted instantiation: BaseLogFile.cc:ink_atoui(char const*) Unexecuted instantiation: ink_time.cc:ink_atoui(char const*) Unexecuted instantiation: ink_cap.cc:ink_atoui(char const*) Unexecuted instantiation: ink_sock.cc:ink_atoui(char const*) Unexecuted instantiation: IOBuffer.cc:ink_atoui(char const*) Unexecuted instantiation: Thread.cc:ink_atoui(char const*) Unexecuted instantiation: Lock.cc:ink_atoui(char const*) Unexecuted instantiation: UnixEThread.cc:ink_atoui(char const*) Unexecuted instantiation: PQ-List.cc:ink_atoui(char const*) Unexecuted instantiation: ProtectedQueue.cc:ink_atoui(char const*) Unexecuted instantiation: UnixEvent.cc:ink_atoui(char const*) Unexecuted instantiation: UnixEventProcessor.cc:ink_atoui(char const*) Unexecuted instantiation: ConfigProcessor.cc:ink_atoui(char const*) Unexecuted instantiation: Version.cc:ink_atoui(char const*) Unexecuted instantiation: RecProcess.cc:ink_atoui(char const*) Unexecuted instantiation: RecRawStatsImpl.cc:ink_atoui(char const*) Unexecuted instantiation: Tasks.cc:ink_atoui(char const*) Unexecuted instantiation: P_RecCore.cc:ink_atoui(char const*) Unexecuted instantiation: RecConfigParse.cc:ink_atoui(char const*) Unexecuted instantiation: RecCore.cc:ink_atoui(char const*) Unexecuted instantiation: RecDebug.cc:ink_atoui(char const*) Unexecuted instantiation: RecFile.cc:ink_atoui(char const*) Unexecuted instantiation: RecMessage.cc:ink_atoui(char const*) Unexecuted instantiation: RecUtils.cc:ink_atoui(char const*) Unexecuted instantiation: RecYAMLDecoder.cc:ink_atoui(char const*) Unexecuted instantiation: RecordsConfigUtils.cc:ink_atoui(char const*) Unexecuted instantiation: RecRawStats.cc:ink_atoui(char const*) Unexecuted instantiation: ConfigContext.cc:ink_atoui(char const*) Unexecuted instantiation: ConfigReloadTrace.cc:ink_atoui(char const*) Unexecuted instantiation: ReloadCoordinator.cc:ink_atoui(char const*) Unexecuted instantiation: fuzz_json.cc:ink_atoui(char const*) Unexecuted instantiation: JsonRPCManager.cc:ink_atoui(char const*) Unexecuted instantiation: fuzz_hpack.cc:ink_atoui(char const*) Unexecuted instantiation: HTTP2.cc:ink_atoui(char const*) Unexecuted instantiation: Http2Frame.cc:ink_atoui(char const*) Unexecuted instantiation: HPACK.cc:ink_atoui(char const*) Unexecuted instantiation: HTTP.cc:ink_atoui(char const*) Unexecuted instantiation: HdrHeap.cc:ink_atoui(char const*) Unexecuted instantiation: HdrToken.cc:ink_atoui(char const*) Unexecuted instantiation: MIME.cc:ink_atoui(char const*) Unexecuted instantiation: HdrUtils.cc:ink_atoui(char const*) Unexecuted instantiation: HttpCompat.cc:ink_atoui(char const*) Unexecuted instantiation: URL.cc:ink_atoui(char const*) Unexecuted instantiation: VersionConverter.cc:ink_atoui(char const*) Unexecuted instantiation: XPACK.cc:ink_atoui(char const*) Unexecuted instantiation: HeaderValidator.cc:ink_atoui(char const*) Unexecuted instantiation: fuzz_proxy_protocol.cc:ink_atoui(char const*) Unexecuted instantiation: ProxyProtocol.cc:ink_atoui(char const*) Unexecuted instantiation: ink_inet.cc:ink_atoui(char const*) Unexecuted instantiation: fuzz_http.cc:ink_atoui(char const*) Unexecuted instantiation: fuzz_rec_http.cc:ink_atoui(char const*) Unexecuted instantiation: RecHttp.cc:ink_atoui(char const*) Unexecuted instantiation: ink_res_init.cc:ink_atoui(char const*) |