|
|
6fe37b |
From b9c5e3668c4022b34734ac8ccb07dd044d4ff38c Mon Sep 17 00:00:00 2001
|
|
|
6fe37b |
From: akallabeth <akallabeth@posteo.net>
|
|
|
6fe37b |
Date: Thu, 13 Oct 2022 08:27:41 +0200
|
|
|
6fe37b |
Subject: [PATCH] Fixed division by zero in urbdrc
|
|
|
6fe37b |
|
|
|
6fe37b |
(cherry picked from commit 731f8419d04b481d7160de1f34062d630ed48765)
|
|
|
6fe37b |
---
|
|
|
6fe37b |
channels/urbdrc/client/libusb/libusb_udevice.c | 12 +++++++++---
|
|
|
6fe37b |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
6fe37b |
|
|
|
6fe37b |
diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c
|
|
|
6fe37b |
index aa69890ae..5784d9fe2 100644
|
|
|
6fe37b |
--- a/channels/urbdrc/client/libusb/libusb_udevice.c
|
|
|
6fe37b |
+++ b/channels/urbdrc/client/libusb/libusb_udevice.c
|
|
|
6fe37b |
@@ -1149,12 +1149,18 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* c
|
|
|
6fe37b |
else
|
|
|
6fe37b |
Stream_Seek(user_data->data, (NumberOfPackets * 12));
|
|
|
6fe37b |
|
|
|
6fe37b |
- iso_packet_size = BufferSize / NumberOfPackets;
|
|
|
6fe37b |
- iso_transfer = libusb_alloc_transfer(NumberOfPackets);
|
|
|
6fe37b |
+ if (NumberOfPackets > 0)
|
|
|
6fe37b |
+ {
|
|
|
6fe37b |
+ iso_packet_size = BufferSize / NumberOfPackets;
|
|
|
6fe37b |
+ iso_transfer = libusb_alloc_transfer((int)NumberOfPackets);
|
|
|
6fe37b |
+ }
|
|
|
6fe37b |
|
|
|
6fe37b |
if (iso_transfer == NULL)
|
|
|
6fe37b |
{
|
|
|
6fe37b |
- WLog_Print(urbdrc->log, WLOG_ERROR, "Error: libusb_alloc_transfer.");
|
|
|
6fe37b |
+ WLog_Print(urbdrc->log, WLOG_ERROR,
|
|
|
6fe37b |
+ "Error: libusb_alloc_transfer [NumberOfPackets=%" PRIu32 ", BufferSize=%" PRIu32
|
|
|
6fe37b |
+ " ]",
|
|
|
6fe37b |
+ NumberOfPackets, BufferSize);
|
|
|
6fe37b |
async_transfer_user_data_free(user_data);
|
|
|
6fe37b |
return -1;
|
|
|
6fe37b |
}
|
|
|
6fe37b |
--
|
|
|
6fe37b |
2.37.1
|
|
|
6fe37b |
|