Skip to content

uv: check libusb_get_config_descriptor return value - #1098

Open
richardw347 wants to merge 1 commit into
AravisProject:mainfrom
richardw347:fix/uv-check-config-descriptor
Open

richardw347 wants to merge 1 commit into
AravisProject:mainfrom
richardw347:fix/uv-check-config-descriptor

Conversation

@richardw347

@richardw347 richardw347 commented Sep 16, 2026

Copy link
Copy Markdown

Summary

libusb_get_config_descriptor() leaves *config undefined on failure. Several USB3Vision paths ignored the return value and immediately used config->bNumInterfaces / altsetting, which segfaults when the device is in a bad USB state (we hit this as segfault at 4 in _usb_device_to_device_ids during discovery).

This change:

  • checks the return value (and config == NULL) in _usb_device_to_device_ids, get_guid_index, and _open_usb_device
  • skips interfaces with a NULL altsetting
  • returns / continues cleanly instead of crashing

Same bug pattern still present on main prior to this PR.

Test plan

  • Build with USB support enabled
  • Enumerate a healthy U3V camera (arv-tool-0.8 / arv-camera-test) — still discovers and opens
  • With a stale/unreachable USB device on the bus (e.g. after soft reboot without power cycle), discovery should warn and skip instead of SIGSEGV

libusb leaves *config undefined on failure. The USB3Vision discovery and
open paths ignored the return value and immediately dereferenced config,
which segfaults (typically at address 4 via bNumInterfaces) when a device
is in a bad USB state. Bail out cleanly and skip NULL altsetting pointers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant