Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,12 +1072,13 @@ uvc_error_t uvc_scan_control(uvc_device_handle_t *devh, uvc_device_info_t *info)

uvc_device_descriptor_t* dev_desc;
int haveTISCamera = 0;
get_device_descriptor ( devh, &dev_desc );
if ( 0x199e == dev_desc->idVendor && ( 0x8101 == dev_desc->idProduct ||
0x8102 == dev_desc->idProduct )) {
haveTISCamera = 1;
if ( get_device_descriptor ( devh, &dev_desc ) == UVC_SUCCESS ) {
if ( 0x199e == dev_desc->idVendor && ( 0x8101 == dev_desc->idProduct ||
0x8102 == dev_desc->idProduct )) {
haveTISCamera = 1;
}
uvc_free_device_descriptor ( dev_desc );
}
uvc_free_device_descriptor ( dev_desc );

for (interface_idx = 0; interface_idx < info->config->bNumInterfaces; ++interface_idx) {
if_desc = &info->config->interface[interface_idx].altsetting[0];
Expand Down Expand Up @@ -1342,6 +1343,23 @@ uvc_error_t uvc_scan_streaming(uvc_device_t *dev,

ret = UVC_SUCCESS;

/* CeraLive (CVE-2026-1991, libuvc issue #300): interface_idx arrives straight
* from an attacker-controlled VideoControl HEADER byte (baInterfaceNr, see
* uvc_parse_vc_header) with no validation. A malformed descriptor can name an
* interface index past config->bNumInterfaces (out-of-bounds read of the
* interface[] array) or one whose interface carries no altsetting
* (altsetting == NULL / num_altsetting == 0). Either way the unguarded
* info->config->interface[interface_idx].altsetting[0] dereference below
* faults. Reject both before any dereference. */
if (interface_idx < 0 || interface_idx >= info->config->bNumInterfaces) {
UVC_EXIT(UVC_ERROR_INVALID_DEVICE);
return UVC_ERROR_INVALID_DEVICE;
}
if (info->config->interface[interface_idx].num_altsetting < 1) {
UVC_EXIT(UVC_ERROR_INVALID_DEVICE);
return UVC_ERROR_INVALID_DEVICE;
}

if_desc = &(info->config->interface[interface_idx].altsetting[0]);
buffer = if_desc->extra;
buffer_left = if_desc->extra_length;
Expand Down
4 changes: 3 additions & 1 deletion src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,9 @@ static int _uvc_stream_params_negotiated(
uvc_stream_ctrl_t *actual) {
return required->bFormatIndex == actual->bFormatIndex &&
required->bFrameIndex == actual->bFrameIndex &&
required->dwMaxPayloadTransferSize == actual->dwMaxPayloadTransferSize;
/* Backport upstream 047920b (#273): the #178 equality check was too strict.
* Some HighSpeed USB cameras return a smaller Max payload than requested. */
required->dwMaxPayloadTransferSize >= actual->dwMaxPayloadTransferSize;
}

/** @internal
Expand Down
Loading