summaryrefslogtreecommitdiff
path: root/test/fuzz
diff options
context:
space:
mode:
authorcopilot-swe-agent[bot] <[email protected]>2026-04-23 09:49:02 +0000
committerGitHub <[email protected]>2026-04-23 09:49:02 +0000
commit5c0c1662464e48681533e8ecc1217613fb6e3820 (patch)
treec3610534cb8307504707bd0c27eab5f461fc863d /test/fuzz
parentb46147a497bf68d680e9a8a898eeca2d255ce53b (diff)
parent1e644339fd984fd6168b8cc09728d3bb56f2eea2 (diff)
Merge upstream master into net descriptor-based ep_size branch
- Resolve .gitignore conflict: incorporate upstream's .worktrees entry and expand dependency path patterns to cover all tools/get_deps.py fetched dirs (lib/, tools/linkermap, tools/uf2, hw/mcu/*) instead of listing only a few - Auto-merged upstream changes: build system cleanups, BSP updates, portability fixes, new boards (nrf54lm20dk, stm32h743_weact), fatfs relocation, and many other upstream improvements - Net driver changes (ecm_rndis_device.c, ncm_device.c, net_device.h, usbd.h, usb_descriptors.c) retain our PR's descriptor-based ep_size approach as our branch takes precedence Co-authored-by: HiFiPhile <[email protected]>
Diffstat (limited to 'test/fuzz')
-rw-r--r--test/fuzz/dcd_fuzz.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/fuzz/dcd_fuzz.cc b/test/fuzz/dcd_fuzz.cc
index 7a5d51623..3e73f0acf 100644
--- a/test/fuzz/dcd_fuzz.cc
+++ b/test/fuzz/dcd_fuzz.cc
@@ -61,14 +61,22 @@ void dcd_int_handler(uint8_t rhport) {
// Choose if we want to generate a signal based on the fuzzed data.
if (_fuzz_data_provider->ConsumeBool()) {
- dcd_event_bus_signal(
- rhport,
- // Choose a random event based on the fuzz data.
- (dcd_eventid_t)_fuzz_data_provider->ConsumeIntegralInRange<uint8_t>(
- DCD_EVENT_INVALID + 1, DCD_EVENT_COUNT - 1),
- // Identify trigger as either an interrupt or a syncrhonous call
- // depending on fuzz data.
- _fuzz_data_provider->ConsumeBool());
+ // Only generate bus signal events that don't carry additional union data.
+ // DCD_EVENT_XFER_COMPLETE, DCD_EVENT_SOF, and DCD_EVENT_BUS_RESET need
+ // properly initialized union fields; USBD_EVENT_FUNC_CALL is internal only.
+ // Valid bus-signal-only events: UNPLUGGED(2), SUSPEND(4), RESUME(5).
+ static const dcd_eventid_t bus_signal_events[] = {
+ DCD_EVENT_UNPLUGGED, DCD_EVENT_SUSPEND, DCD_EVENT_RESUME};
+ uint8_t idx = _fuzz_data_provider->ConsumeIntegralInRange<uint8_t>(0, 2);
+ dcd_event_bus_signal(rhport, bus_signal_events[idx],
+ _fuzz_data_provider->ConsumeBool());
+ }
+
+ // Optionally generate a BUS_RESET event with a valid speed value.
+ if (_fuzz_data_provider->ConsumeBool()) {
+ tusb_speed_t speed = (tusb_speed_t)_fuzz_data_provider->ConsumeIntegralInRange<uint8_t>(
+ TUSB_SPEED_FULL, TUSB_SPEED_HIGH);
+ dcd_event_bus_reset(rhport, speed, _fuzz_data_provider->ConsumeBool());
}
if (_fuzz_data_provider->ConsumeBool()) {