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

Unified Diff: webkit/plugins/ppapi/quota_file_io_unittest.cc

Issue 7651002: Adding checks to guard against buffer overruns in QuotaFileIO::Write and base::FileUtilProxy::Write (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« ppapi/c/ppb_file_io.h ('K') | « webkit/plugins/ppapi/quota_file_io.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/quota_file_io_unittest.cc
===================================================================
--- webkit/plugins/ppapi/quota_file_io_unittest.cc (revision 96790)
+++ webkit/plugins/ppapi/quota_file_io_unittest.cc (working copy)
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include <deque>
+#include <limits>
+#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_callback_factory.h"
@@ -115,6 +117,16 @@
}
void WriteTestBody(bool will_operation) {
+ // Attempt to write zero bytes.
+ EXPECT_FALSE(quota_file_io_->Write(0, "data", 0,
+ callback_factory_.NewCallback(
+ &QuotaFileIOTest::DidWrite)));
+ // Attempt to write negative number of bytes.
+ EXPECT_FALSE(quota_file_io_->Write(0, "data",
+ std::numeric_limits<int32_t>::min(),
+ callback_factory_.NewCallback(
+ &QuotaFileIOTest::DidWrite)));
+
quota_plugin_delegate()->set_available_space(100);
std::string read_buffer;
« ppapi/c/ppb_file_io.h ('K') | « webkit/plugins/ppapi/quota_file_io.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698