/src/opensips/parser/fuzz_msg_parser.c
Line | Count | Source |
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 "../parser/sdp/sdp.h" |
13 | | |
14 | | #include "../cachedb/test/test_cachedb.h" |
15 | | #include "../lib/test/test_csv.h" |
16 | | #include "../mem/test/test_malloc.h" |
17 | | #include "../str.h" |
18 | | |
19 | | #include "../context.h" |
20 | | #include "../dprint.h" |
21 | | #include "../globals.h" |
22 | | #include "../lib/list.h" |
23 | | #include "../sr_module.h" |
24 | | #include "../sr_module_deps.h" |
25 | | |
26 | | #include "../test/fuzz/fuzz_standalone.h" |
27 | | |
28 | 15.8k | int LLVMFuzzerTestOneInput(const char *data, size_t size) { |
29 | | |
30 | 15.8k | if (size <= 1) { |
31 | 1 | return 0; |
32 | 1 | } |
33 | | |
34 | 15.8k | struct sip_msg orig_inv = {}; |
35 | 15.8k | orig_inv.buf = (char *)data; |
36 | 15.8k | orig_inv.len = size; |
37 | | |
38 | 15.8k | parse_msg(orig_inv.buf, orig_inv.len, &orig_inv); |
39 | 15.8k | free_sip_msg(&orig_inv); |
40 | 15.8k | return 0; |
41 | 15.8k | } |