summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_streamcontentparser.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-22 09:04:58 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-23 12:52:19 +0000
commit77d8317f2e6bb9c75d96390fdf843b86694ba6d2 (patch)
treec634a60674bb6e45d357a7d89d9287994fcbea15 /core/fpdfapi/page/cpdf_streamcontentparser.cpp
parent627b316e1e521547395a280a9a095c77b046988e (diff)
downloadpdfium-77d8317f2e6bb9c75d96390fdf843b86694ba6d2.tar.xz
Verify image returned from AddImage
The ::AddImage call can return a nullptr if there is no stream provided. This CL adds the missing null check on the returned object when lookikng at the image. Bug: chromium:756418, chromium:753700 Change-Id: I48032c0f421c8889827540ae91f404ef0f503bfe Reviewed-on: https://pdfium-review.googlesource.com/11532 Reviewed-by: Rebekah Potter <rbpotter@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamcontentparser.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 1d5ddaeed2..42ed3fc3b4 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -660,7 +660,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
CPDF_ImageObject* pObj = AddImage(std::move(pStream));
// Record the bounding box of this image, so rendering code can draw it
// properly.
- if (pObj->GetImage()->IsMask())
+ if (pObj && pObj->GetImage()->IsMask())
m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
}
@@ -733,7 +733,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
CPDF_ImageObject* pObj = AddImage(m_pLastImage);
// Record the bounding box of this image, so rendering code can draw it
// properly.
- if (pObj->GetImage()->IsMask())
+ if (pObj && pObj->GetImage()->IsMask())
m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
return;
}
@@ -755,9 +755,11 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
: AddImage(pXObject->GetObjNum());
m_LastImageName = name;
- m_pLastImage = pObj->GetImage();
- if (m_pLastImage->IsMask())
- m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
+ if (pObj) {
+ m_pLastImage = pObj->GetImage();
+ if (m_pLastImage->IsMask())
+ m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
+ }
} else if (type == "Form") {
AddForm(pXObject);
}