diff options
author | reillyg <reillyg@chromium.org> | 2014-08-24 00:11:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-24 07:13:02 +0000 |
commit | 70cdd67c0293cef1216422386ff92018770c4b70 (patch) | |
tree | 6aa4877338c58365efc97f406e7beac8dbafc52d /device/hid/hid_report_descriptor_unittest.cc | |
parent | c92d18afd4b6e965345ddef87b9716480f48c665 (diff) | |
download | chromium_src-70cdd67c0293cef1216422386ff92018770c4b70.zip chromium_src-70cdd67c0293cef1216422386ff92018770c4b70.tar.gz chromium_src-70cdd67c0293cef1216422386ff92018770c4b70.tar.bz2 |
Store HID report sizes as uint16_t.
HID report sizes are unsigned values. In addition they should (because
of the limited size of USB control transfers) never be larger than 64k.
In reality that would be an absolutely enormous report and unlikely to
ever been seen in the wild. By limiting the storage size for report
lengths to a uint16_t we therefore also limit our exposure to being
convinced to allocate unreasonably large buffers by a malicious device.
The Windows HID parser already limits report sizes to a USHORT value.
BUG=
Review URL: https://codereview.chromium.org/492963007
Cr-Commit-Position: refs/heads/master@{#291624}
Diffstat (limited to 'device/hid/hid_report_descriptor_unittest.cc')
-rw-r--r-- | device/hid/hid_report_descriptor_unittest.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/device/hid/hid_report_descriptor_unittest.cc b/device/hid/hid_report_descriptor_unittest.cc index 0cce2e6..8bc04f1 100644 --- a/device/hid/hid_report_descriptor_unittest.cc +++ b/device/hid/hid_report_descriptor_unittest.cc @@ -298,18 +298,18 @@ class HidReportDescriptorTest : public testing::Test { void ValidateDetails( const std::vector<HidCollectionInfo>& expected_collections, const bool expected_has_report_id, - const int expected_max_input_report_size, - const int expected_max_output_report_size, - const int expected_max_feature_report_size, + const uint16_t expected_max_input_report_size, + const uint16_t expected_max_output_report_size, + const uint16_t expected_max_feature_report_size, const uint8_t* bytes, size_t size) { descriptor_ = new HidReportDescriptor(bytes, size); std::vector<HidCollectionInfo> actual_collections; bool actual_has_report_id; - int actual_max_input_report_size; - int actual_max_output_report_size; - int actual_max_feature_report_size; + uint16_t actual_max_input_report_size; + uint16_t actual_max_output_report_size; + uint16_t actual_max_feature_report_size; descriptor_->GetDetails(&actual_collections, &actual_has_report_id, &actual_max_input_report_size, |