summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorikarienator@chromium.org <ikarienator@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-30 20:51:45 +0000
committerikarienator@chromium.org <ikarienator@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-30 20:51:45 +0000
commita77fbe37ec3cb1877787ec2b9cacaf6d5352ad0d (patch)
treeba3e35ea470db256f3d133065f9a061d52b4238c
parent4a2af806be5b1248fb9636b6755430305e97a0a5 (diff)
downloadchromium_src-a77fbe37ec3cb1877787ec2b9cacaf6d5352ad0d.zip
chromium_src-a77fbe37ec3cb1877787ec2b9cacaf6d5352ad0d.tar.gz
chromium_src-a77fbe37ec3cb1877787ec2b9cacaf6d5352ad0d.tar.bz2
Merge 219327 "Emergency fix for Mac: crash with EXC_ARITHMETIC i..."
> Emergency fix for Mac: crash with EXC_ARITHMETIC in submit_bulk_transfer. > > usb_interface_t::GetPipeProperties may fail when the device is unplugged if DeviceVersion is not greater than 320. This case maxPacketSize will be zero on official build and the integer division will may throw a EXC_ARITHMETIC signal. > > BUG=278058 > > Review URL: https://chromiumcodereview.appspot.com/23137025 TBR=ikarienator@chromium.org Review URL: https://codereview.chromium.org/23726014 git-svn-id: svn://svn.chromium.org/chrome/branches/1599/src@220651 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--third_party/libusb/README.chromium1
-rw-r--r--third_party/libusb/darwin-sigfpe.patch22
-rw-r--r--third_party/libusb/src/libusb/os/darwin_usb.c10
3 files changed, 31 insertions, 2 deletions
diff --git a/third_party/libusb/README.chromium b/third_party/libusb/README.chromium
index b0e8ada6..348d919 100644
--- a/third_party/libusb/README.chromium
+++ b/third_party/libusb/README.chromium
@@ -15,3 +15,4 @@ Local Modifications:
- Exposing an API (libusb_interrupt_handle_event) to explicitly interrupt
libusb_handle_event.
- windows-build.patch has been applied.
+- darwin-sigfpe.patch has been applied.
diff --git a/third_party/libusb/darwin-sigfpe.patch b/third_party/libusb/darwin-sigfpe.patch
new file mode 100644
index 0000000..3c74db1
--- /dev/null
+++ b/third_party/libusb/darwin-sigfpe.patch
@@ -0,0 +1,22 @@
+diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
+index b0ee5b2..fe40899 100644
+--- a/libusb/os/darwin_usb.c
++++ b/libusb/os/darwin_usb.c
+@@ -1449,8 +1449,14 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
+
+ cInterface = &priv->interfaces[iface];
+
+- (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
+- &transferType, &maxPacketSize, &interval);
++ ret = (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
++ &transferType, &maxPacketSize, &interval);
++
++ if (ret) {
++ usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
++ darwin_error_str(ret), ret);
++ return darwin_to_libusb (ret);
++ }
+
+ if (0 != (transfer->length % maxPacketSize)) {
+ /* do not need a zero packet */
+
diff --git a/third_party/libusb/src/libusb/os/darwin_usb.c b/third_party/libusb/src/libusb/os/darwin_usb.c
index a24558c..3f315e8 100644
--- a/third_party/libusb/src/libusb/os/darwin_usb.c
+++ b/third_party/libusb/src/libusb/os/darwin_usb.c
@@ -1448,8 +1448,14 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
cInterface = &priv->interfaces[iface];
- (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
- &transferType, &maxPacketSize, &interval);
+ ret = (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
+ &transferType, &maxPacketSize, &interval);
+
+ if (ret) {
+ usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
+ darwin_error_str(ret), ret);
+ return darwin_to_libusb (ret);
+ }
if (0 != (transfer->length % maxPacketSize)) {
/* do not need a zero packet */