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