Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: chrome/browser/usb/usb_device.cc

Issue 12096024: Add validation to length, packets and packetLength parameters (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/usb/usb_device.cc
===================================================================
--- chrome/browser/usb/usb_device.cc (revision 178629)
+++ chrome/browser/usb/usb_device.cc (working copy)
@@ -279,10 +279,8 @@
CheckDevice();
const uint64 total_length = packets * packet_length;
- if (total_length > length) {
- callback.Run(USB_TRANSFER_LENGTH_SHORT, NULL, 0);
- return;
- }
+ CHECK(packets > length || total_length > length) <<
+ "transfer length is too small";
struct libusb_transfer* const transfer = libusb_alloc_transfer(packets);
const uint8 new_endpoint = ConvertTransferDirection(direction) | endpoint;

Powered by Google App Engine
This is Rietveld 408576698