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

Unified Diff: media/audio/win/audio_manager_win.cc

Issue 8418034: Make string_util::WriteInto() DCHECK() that the supplied |length_with_null| > 1, meaning that the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « crypto/symmetric_key_openssl.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_manager_win.cc
===================================================================
--- media/audio/win/audio_manager_win.cc (revision 111826)
+++ media/audio/win/audio_manager_win.cc (working copy)
@@ -211,12 +211,14 @@
waveInMessage(reinterpret_cast<HWAVEIN>(device_id),
DRV_QUERYDEVICEINTERFACESIZE,
reinterpret_cast<DWORD_PTR>(&device_interface_name_size), 0);
- if (device_interface_name_size == 0) // No audio capture device?
- return string16();
+ size_t bytes_in_char16 = sizeof(string16::value_type);
+ DCHECK_EQ(0u, device_interface_name_size % bytes_in_char16);
+ if (device_interface_name_size <= bytes_in_char16)
+ return string16(); // No audio capture device.
string16 device_interface_name;
string16::value_type* name_ptr = WriteInto(&device_interface_name,
- device_interface_name_size / sizeof(string16::value_type));
+ device_interface_name_size / bytes_in_char16);
waveInMessage(reinterpret_cast<HWAVEIN>(device_id),
DRV_QUERYDEVICEINTERFACE,
reinterpret_cast<DWORD_PTR>(name_ptr),
« no previous file with comments | « crypto/symmetric_key_openssl.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698