Commit 09555f69 authored by sadrul@chromium.org's avatar sadrul@chromium.org

pdf: Early out from CopyImage if there's nothing to copy.

If CopyImage is called with src is an empty rectangle (this can happen for
example if one of the resources is not available), then the code ends up trying
to read from null/uninitialized memory. So early out instead in such cases.

BUG=401242
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/465133005

Cr-Commit-Position: refs/heads/master@{#290736}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290736 0039d316-1c4b-4281-b951-d872f2087c98
parent 7998425d
......@@ -146,7 +146,9 @@ void CopyImage(const pp::ImageData& src, const pp::Rect& src_rc,
pp::ImageData* dest, const pp::Rect& dest_rc,
bool stretch) {
DCHECK(src_rc.width() <= dest_rc.width() &&
src_rc.height() <= dest_rc.height());
src_rc.height() <= dest_rc.height());
if (src_rc.IsEmpty())
return;
const uint32_t* src_origin_pixel = src.GetAddr32(src_rc.point());
uint32_t* dest_origin_pixel = dest->GetAddr32(dest_rc.point());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment