1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at: 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #include "btcore/include/hal_util.h" 19 #include "btcore/include/module.h" 20 21 extern const module_t osi_module; 22 23 extern "C" { android_get_exported_namespace(const char *)24struct android_namespace_t* android_get_exported_namespace(const char*) { return nullptr; } 25 } 26 27 class BTCoreModuleFuzzer { 28 public: 29 void process(); 30 }; 31 process()32void BTCoreModuleFuzzer::process() { 33 const bt_interface_t* interface; 34 (void)hal_util_load_bt_library(&interface); 35 module_management_start(); 36 module_init(&osi_module); 37 (void)module_start_up(&osi_module); 38 (void)get_module(osi_module.name); 39 module_shut_down(&osi_module); 40 module_clean_up(&osi_module); 41 module_management_stop(); 42 } 43 LLVMFuzzerTestOneInput(const uint8_t *,size_t)44extern "C" int LLVMFuzzerTestOneInput(const uint8_t*, size_t) { 45 BTCoreModuleFuzzer btCoreModuleFuzzer; 46 btCoreModuleFuzzer.process(); 47 return 0; 48 } 49