Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright 2021 Google LLC |
2 | | Licensed under the Apache License, Version 2.0 (the "License"); |
3 | | you may not use this file except in compliance with the License. |
4 | | You may obtain a copy of the License at |
5 | | http://www.apache.org/licenses/LICENSE-2.0 |
6 | | Unless required by applicable law or agreed to in writing, software |
7 | | distributed under the License is distributed on an "AS IS" BASIS, |
8 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
9 | | See the License for the specific language governing permissions and |
10 | | limitations under the License. |
11 | | */ |
12 | | #include <sys_defs.h> |
13 | | #include <stdint.h> |
14 | | #include <stddef.h> |
15 | | #include <stdlib.h> |
16 | | #include <stdarg.h> |
17 | | #include <string.h> |
18 | | |
19 | | #include <vstring.h> |
20 | | |
21 | | #include "lex_822.h" |
22 | | #include "quote_822_local.h" |
23 | | #include "tok822.h" |
24 | | |
25 | | |
26 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); |
27 | | |
28 | | int |
29 | | LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
30 | 1.95k | { |
31 | 1.95k | char *new_str = (char *)malloc(size+1); |
32 | 1.95k | if (new_str == NULL){ |
33 | 0 | return 0; |
34 | 0 | } |
35 | 1.95k | memcpy(new_str, data, size); |
36 | 1.95k | new_str[size] = '\0'; |
37 | | |
38 | 1.95k | VSTRING *vp = vstring_alloc(100); |
39 | 1.95k | TOK822 *list = NULL; |
40 | 1.95k | list = tok822_parse_limit(new_str, 10); |
41 | 1.95k | tok822_internalize(vp, list, TOK822_STR_DEFL); |
42 | 1.95k | tok822_externalize(vp, list,TOK822_STR_DEFL | TOK822_STR_TRNC); |
43 | 1.95k | tok822_externalize(vp, list,TOK822_STR_DEFL | TOK822_STR_LINE | TOK822_STR_TRNC); |
44 | 1.95k | tok822_free_tree(list); |
45 | 1.95k | vstring_free(vp); |
46 | | |
47 | 1.95k | free(new_str); |
48 | 1.95k | return 0; |
49 | 1.95k | } |