Skip to content

Commit

Permalink
Fixed division by zero in urbdrc
Browse files Browse the repository at this point in the history
(cherry picked from commit 731f841)
  • Loading branch information
akallabeth committed Nov 14, 2022
1 parent 41185a2 commit 80adde1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions channels/urbdrc/client/libusb/libusb_udevice.c
Expand Up @@ -1221,12 +1221,18 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* c
if (!Buffer)
Stream_Seek(user_data->data, (NumberOfPackets * 12));

iso_packet_size = BufferSize / NumberOfPackets;
iso_transfer = libusb_alloc_transfer(NumberOfPackets);
if (NumberOfPackets > 0)
{
iso_packet_size = BufferSize / NumberOfPackets;
iso_transfer = libusb_alloc_transfer((int)NumberOfPackets);
}

if (iso_transfer == NULL)
{
WLog_Print(urbdrc->log, WLOG_ERROR, "Error: libusb_alloc_transfer.");
WLog_Print(urbdrc->log, WLOG_ERROR,
"Error: libusb_alloc_transfer [NumberOfPackets=%" PRIu32 ", BufferSize=%" PRIu32
" ]",
NumberOfPackets, BufferSize);
async_transfer_user_data_free(user_data);
return -1;
}
Expand Down

0 comments on commit 80adde1

Please sign in to comment.