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 "../cachedb/test/test_cachedb.h" 13 #include "../lib/test/test_csv.h" 14 #include "../mem/test/test_malloc.h" 15 #include "../str.h" 16 17 #include "../context.h" 18 #include "../dprint.h" 19 #include "../globals.h" 20 #include "../lib/list.h" 21 #include "../sr_module.h" 22 #include "../sr_module_deps.h" 23 24 #include "parse_uri.h" 25 LLVMFuzzerTestOneInput(const char * data,size_t size)26int LLVMFuzzerTestOneInput(const char *data, size_t size) { 27 ensure_global_context(); 28 struct sip_uri u; 29 30 char *new_str = (char *)malloc(size + 1); 31 if (new_str == NULL) { 32 return 0; 33 } 34 memcpy(new_str, data, size); 35 new_str[size] = '\0'; 36 37 parse_uri(STR_L(new_str), &u); 38 39 free(new_str); 40 } 41