diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 21:43:39 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 21:43:39 +0000 |
commit | cecc8346b4c3bc90aa2091452bf96dd142271a05 (patch) | |
tree | 82df4c8a54f26e6fc89255724f1a09cc3a67b758 /content/browser/renderer_host/software_frame_manager.cc | |
parent | 4db78f084fbe3f5ecce8b8a9170c0ae7eb07843f (diff) | |
download | chromium_src-cecc8346b4c3bc90aa2091452bf96dd142271a05.zip chromium_src-cecc8346b4c3bc90aa2091452bf96dd142271a05.tar.gz chromium_src-cecc8346b4c3bc90aa2091452bf96dd142271a05.tar.bz2 |
Move SoftwareFrameData overflow checks to the IPC code.
Instead of doing this check in SoftwareFrameManager and silently
dropping the frame, if we have an overflow, drop the IPC from the
renderer (and cause a renderer crash which we can see).
Also move computation code for the frame size in bytes to
SoftwareFrameData so the computation and the check can be beside
each other.
Also add unit tests for SoftwareFrameData IPC.
R=ccameron@chromium.org, jschuh@chromium.org, piman@chromium.org, ccameron, piman
BUG=348332
Review URL: https://codereview.chromium.org/196423027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/software_frame_manager.cc')
-rw-r--r-- | content/browser/renderer_host/software_frame_manager.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/content/browser/renderer_host/software_frame_manager.cc b/content/browser/renderer_host/software_frame_manager.cc index 387dc00..3630e59 100644 --- a/content/browser/renderer_host/software_frame_manager.cc +++ b/content/browser/renderer_host/software_frame_manager.cc @@ -97,15 +97,9 @@ bool SoftwareFrameManager::SwapToNewFrame( // The NULL handle is used in testing. if (base::SharedMemory::IsHandleValid(shared_memory->handle())) { - base::CheckedNumeric<size_t> size_in_bytes_checked = - base::CheckedNumeric<size_t>(4) * - base::CheckedNumeric<size_t>(frame_data->size.width()) * - base::CheckedNumeric<size_t>(frame_data->size.height()); - if (!size_in_bytes_checked.IsValid()) { - DLOG(ERROR) << "Integer overflow when computing bytes to map."; - return false; - } - size_t size_in_bytes = size_in_bytes_checked.ValueOrDie(); + DCHECK(frame_data->CheckedSizeInBytes().IsValid()) + << "Integer overflow when computing bytes to map."; + size_t size_in_bytes = frame_data->SizeInBytes(); #ifdef OS_WIN if (!shared_memory->Map(0)) { DLOG(ERROR) << "Unable to map renderer memory."; |