summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
authornoelallen@chromium.org <noelallen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 20:53:00 +0000
committernoelallen@chromium.org <noelallen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 20:53:00 +0000
commit81d4b8c3ae7f9bb759e1f2d4c67e3f07bab2f8bb (patch)
tree61bc0210de74134b12cf3d6b60d1f5f6e4122aaf /ppapi/shared_impl
parentcaa9e1e23f2dadcb33e531e23f0697efb41a3895 (diff)
downloadchromium_src-81d4b8c3ae7f9bb759e1f2d4c67e3f07bab2f8bb.zip
chromium_src-81d4b8c3ae7f9bb759e1f2d4c67e3f07bab2f8bb.tar.gz
chromium_src-81d4b8c3ae7f9bb759e1f2d4c67e3f07bab2f8bb.tar.bz2
Fix read size 0 in shared ppb_file_io.
We check that the src and dst pointers are non-null, however a read of size zero is a NOP. Typically library behavior is to ignore invalid arguments when no work is actually done. BUG=110087 R=brettw@chromium.org Review URL: http://codereview.chromium.org/9695021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/ppb_file_io_shared.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/ppapi/shared_impl/ppb_file_io_shared.cc b/ppapi/shared_impl/ppb_file_io_shared.cc
index 63945b5..e54bd3c 100644
--- a/ppapi/shared_impl/ppb_file_io_shared.cc
+++ b/ppapi/shared_impl/ppb_file_io_shared.cc
@@ -159,13 +159,13 @@ void PPB_FileIO_Shared::ExecuteReadCallback(int32_t pp_error,
return;
}
- char* read_buffer = callbacks_.front().read_buffer;
- DCHECK(data);
- DCHECK(read_buffer);
-
// The result code contains the number of bytes if it's positive.
- if (pp_error > 0)
+ if (pp_error > 0) {
+ char* read_buffer = callbacks_.front().read_buffer;
+ DCHECK(data);
+ DCHECK(read_buffer);
memcpy(read_buffer, data, pp_error);
+ }
RunAndRemoveFirstPendingCallback(pp_error);
}