summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-12-18 20:41:23 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-18 20:41:23 +0000
commit9ecd41496d25a077adfafc975ad201c3fc15b60a (patch)
tree3000c33a86231ec277ceef438c2b69a487756c43
parentf1d8442ec2b063ec4da7ab129a67ec3f39278dee (diff)
downloadpdfium-9ecd41496d25a077adfafc975ad201c3fc15b60a.tar.xz
[Merge M64] Fix null-dereference in CPDF_ShadingPattern::Load().
BUG=chromium:795490 TBR=hnakashima@chromium.org Change-Id: Ic9f12c1c709c148f7294ab2aaf65fcc695960835 Reviewed-on: https://pdfium-review.googlesource.com/21530 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> (cherry picked from commit 682118834b3cf2b5510ee676088fdd8f11869e84) Reviewed-on: https://pdfium-review.googlesource.com/21630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index 585a925ba7..ef40f54182 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -89,13 +89,14 @@ bool CPDF_ShadingPattern::Load() {
CPDF_DocPageData* pDocPageData = document()->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, nullptr);
- // The color space cannot be a Pattern space, according to the PDF 1.7 spec,
- // page 305.
- if (m_pCS->GetFamily() == PDFCS_PATTERN)
- return false;
+ if (m_pCS) {
+ // The color space cannot be a Pattern space, according to the PDF 1.7 spec,
+ // page 305.
+ if (m_pCS->GetFamily() == PDFCS_PATTERN)
+ return false;
- if (m_pCS)
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
+ }
m_ShadingType = ToShadingType(pShadingDict->GetIntegerFor("ShadingType"));