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

Unified Diff: ppapi/tests/test_file_io.cc

Issue 7655009: Adding guards against heap overflow in PPB_FileIO::Read (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
« no previous file with comments | « base/file_util_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_file_io.cc
===================================================================
--- ppapi/tests/test_file_io.cc (revision 97034)
+++ ppapi/tests/test_file_io.cc (working copy)
@@ -4,7 +4,6 @@
#include "ppapi/tests/test_file_io.h"
-#include <stdio.h>
#include <string.h>
#include "base/memory/scoped_ptr.h"
@@ -257,6 +256,15 @@
if (rv != PP_OK)
return ReportError("FileIO::Write", rv);
+ // Check for failing read operation.
+ char buf[256];
+ rv = file_io.Read(0, buf, -1, // negative number of bytes to read
+ callback);
+ if (rv == PP_OK_COMPLETIONPENDING)
+ rv = callback.WaitForResult();
+ if (rv != PP_ERROR_FAILED)
+ return ReportError("FileIO::Read", rv);
+
// Read the entire file.
std::string read_buffer;
rv = ReadEntireFile(instance_->pp_instance(), &file_io, 0, &read_buffer);
« no previous file with comments | « base/file_util_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698