mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
test/fuzz: fix memory in l2cap fuzzer
This commit is contained in:
parent
68894c7457
commit
e3ea12006b
@ -213,11 +213,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
if (initialized == 0){
|
if (initialized == 0){
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
btstack_memory_init();
|
|
||||||
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
|
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
|
||||||
hci_connection.con_handle = 0x0000;
|
hci_connection.con_handle = 0x0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btstack_memory_init();
|
||||||
|
|
||||||
// prepare test data
|
// prepare test data
|
||||||
if (size < 5) return 0;
|
if (size < 5) return 0;
|
||||||
uint8_t packet_type = (data[0] & 1) ? HCI_EVENT_PACKET : HCI_ACL_DATA_PACKET;
|
uint8_t packet_type = (data[0] & 1) ? HCI_EVENT_PACKET : HCI_ACL_DATA_PACKET;
|
||||||
@ -287,5 +288,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
|
|
||||||
// teardown
|
// teardown
|
||||||
l2cap_free_channels_fuzz();
|
l2cap_free_channels_fuzz();
|
||||||
|
|
||||||
|
btstack_memory_deinit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user