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

Side by Side Diff: base/file_util_proxy.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/tests/test_file_io.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util_proxy.h" 5 #include "base/file_util_proxy.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 8
9 // TODO(jianli): Move the code from anonymous namespace to base namespace so 9 // TODO(jianli): Move the code from anonymous namespace to base namespace so
10 // that all of the base:: prefixes would be unnecessary. 10 // that all of the base:: prefixes would be unnecessary.
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 new RelayDelete(file_path, true, callback)); 847 new RelayDelete(file_path, true, callback));
848 } 848 }
849 849
850 // static 850 // static
851 bool FileUtilProxy::Read( 851 bool FileUtilProxy::Read(
852 scoped_refptr<MessageLoopProxy> message_loop_proxy, 852 scoped_refptr<MessageLoopProxy> message_loop_proxy,
853 PlatformFile file, 853 PlatformFile file,
854 int64 offset, 854 int64 offset,
855 int bytes_to_read, 855 int bytes_to_read,
856 ReadCallback* callback) { 856 ReadCallback* callback) {
857 if (bytes_to_read < 0)
858 return false;
857 return Start(FROM_HERE, message_loop_proxy, 859 return Start(FROM_HERE, message_loop_proxy,
858 new RelayRead(file, offset, bytes_to_read, callback)); 860 new RelayRead(file, offset, bytes_to_read, callback));
859 } 861 }
860 862
861 // static 863 // static
862 bool FileUtilProxy::Write( 864 bool FileUtilProxy::Write(
863 scoped_refptr<MessageLoopProxy> message_loop_proxy, 865 scoped_refptr<MessageLoopProxy> message_loop_proxy,
864 PlatformFile file, 866 PlatformFile file,
865 int64 offset, 867 int64 offset,
866 const char* buffer, 868 const char* buffer,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 918
917 // static 919 // static
918 bool FileUtilProxy::Flush( 920 bool FileUtilProxy::Flush(
919 scoped_refptr<MessageLoopProxy> message_loop_proxy, 921 scoped_refptr<MessageLoopProxy> message_loop_proxy,
920 PlatformFile file, 922 PlatformFile file,
921 StatusCallback* callback) { 923 StatusCallback* callback) {
922 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); 924 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback));
923 } 925 }
924 926
925 } // namespace base 927 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | ppapi/tests/test_file_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698