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

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, 10 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 182069)
+++ chrome/browser/usb/usb_device.cc (working copy)
@@ -277,10 +277,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;
« no previous file with comments | « chrome/browser/extensions/api/usb/usb_api.cc ('k') | chrome/test/data/extensions/api_test/usb/invalid_length_transfer/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698