Merge pull request #1867 from silvergasp/thread_local_globals

fix: Change all static variables to thread when fuzzing
This commit is contained in:
Ha Thach
2023-02-22 12:54:32 +07:00
committed by GitHub
19 changed files with 67 additions and 57 deletions

View File

@@ -39,7 +39,7 @@ struct State {
uint8_t address;
};
static State state = {false, 0, 0};
static _fuzz_thread State state = {false, 0, 0};
//--------------------------------------------------------------------+
// Controller API

View File

@@ -44,7 +44,7 @@
// Invoked when received GET DEVICE DESCRIPTOR
// Application return pointer to descriptor
uint8_t const *tud_descriptor_device_cb(void) {
static tusb_desc_device_t const desc_device = {
static _fuzz_thread tusb_desc_device_t const desc_device = {
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = USB_BCD,
@@ -184,7 +184,7 @@ char const *string_desc_arr[] = {
};
static uint16_t _desc_str[32];
static _fuzz_thread uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long

View File

@@ -45,7 +45,7 @@
// Invoked when received GET DEVICE DESCRIPTOR
// Application return pointer to descriptor
uint8_t const *tud_descriptor_device_cb(void) {
static tusb_desc_device_t const desc_device = {
static _fuzz_thread tusb_desc_device_t const desc_device = {
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = USB_BCD,
@@ -189,7 +189,7 @@ char const *string_desc_arr[] = {
"TinyUSB CDC", // 4: CDC Interface
};
static uint16_t _desc_str[32];
static _fuzz_thread uint16_t _desc_str[32];
// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long

View File

@@ -78,7 +78,8 @@ CFLAGS += \
CFLAGS += \
-Wno-error=unreachable-code \
-DOPT_MCU_FUZZ=1 \
-DCFG_TUSB_MCU=OPT_MCU_FUZZ
-DCFG_TUSB_MCU=OPT_MCU_FUZZ \
-D_FUZZ
CXXFLAGS += \
-xc++ \