summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_shadingpattern.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-12-19 18:35:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-19 18:35:43 +0000
commit8ab9f80a944c16000f6a6f15366dd3704d315401 (patch)
treedbfd9de84452087c92856ff0ea732db8e6034460 /core/fpdfapi/page/cpdf_shadingpattern.cpp
parentfbec801a8dd8ac30dc2f08385deb0ac81031f3f5 (diff)
downloadpdfium-8ab9f80a944c16000f6a6f15366dd3704d315401.tar.xz
Require valid color space for shading pattern.
Bug: chromium:795889 Change-Id: If29a0f6f7d95bedf014464239da1f8b56e55c9b6 Reviewed-on: https://pdfium-review.googlesource.com/21750 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_shadingpattern.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index ef40f54182..d4adf906ba 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -89,14 +89,13 @@ bool CPDF_ShadingPattern::Load() {
CPDF_DocPageData* pDocPageData = document()->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, nullptr);
- 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;
- m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
- }
+ // The color space is required and cannot be a Pattern space, according to the
+ // PDF 1.7 spec, page 305.
+ if (!m_pCS || m_pCS->GetFamily() == PDFCS_PATTERN)
+ return false;
+
+ m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
m_ShadingType = ToShadingType(pShadingDict->GetIntegerFor("ShadingType"));