From 8ab9f80a944c16000f6a6f15366dd3704d315401 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 19 Dec 2017 18:35:43 +0000 Subject: 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 Reviewed-by: Lei Zhang --- core/fpdfapi/page/cpdf_shadingpattern.cpp | 13 ++++++------- 1 file 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")); -- cgit v1.2.3