summaryrefslogtreecommitdiffstats
path: root/pdf/draw_utils.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-20 02:44:41 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-20 02:46:34 +0000
commit09555f6952ea240c33452dd0ee1575bc26f73195 (patch)
treefd816de0ae8a13b23900d97cefd59e1dfc9e04c1 /pdf/draw_utils.cc
parent7998425d7c9f781de8bfad0428a0f0f94b563190 (diff)
downloadchromium_src-09555f6952ea240c33452dd0ee1575bc26f73195.zip
chromium_src-09555f6952ea240c33452dd0ee1575bc26f73195.tar.gz
chromium_src-09555f6952ea240c33452dd0ee1575bc26f73195.tar.bz2
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
Diffstat (limited to 'pdf/draw_utils.cc')
-rw-r--r--pdf/draw_utils.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/pdf/draw_utils.cc b/pdf/draw_utils.cc
index 0976de9..8bc3ac3 100644
--- a/pdf/draw_utils.cc
+++ b/pdf/draw_utils.cc
@@ -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());