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

Unified Diff: extensions/browser/api/usb/usb_apitest.cc

Issue 275993002: Initialize an IOBuffer in UsbApiTest.TransferEvent to avoid an uninitialized read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/usb/usb_apitest.cc
diff --git a/extensions/browser/api/usb/usb_apitest.cc b/extensions/browser/api/usb/usb_apitest.cc
index 335258de1349ac24735eb00d5f44c1c3cc73e2e6..b3770cef41230e5c8d362a3b4d2a7e1be58bc61f 100644
--- a/extensions/browser/api/usb/usb_apitest.cc
+++ b/extensions/browser/api/usb/usb_apitest.cc
@@ -27,7 +27,9 @@ namespace {
ACTION_TEMPLATE(InvokeUsbTransferCallback,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(p1)) {
- ::std::tr1::get<k>(args).Run(p1, new net::IOBuffer(1), 1);
+ net::IOBuffer* io_buffer = new net::IOBuffer(1);
+ memset(io_buffer->data(), 0, 1); // Avoid uninitialized reads.
+ ::std::tr1::get<k>(args).Run(p1, io_buffer, 1);
}
// MSVC erroneously thinks that at least one of the arguments for the transfer
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698