From 1c0de38c90947694b5d75349802a0b737418afe3 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 30 May 2018 18:35:31 +0000 Subject: Exclude certain colorspace types for calculating transparency backdrop color. Per discussion for the "CS" entry in the PDF 1.7 spec table 7.13, several types of colorspaces do not meet the requirements of this particular colorspace entry. In terms of implementation, this avoids hitting a NOTREACHED() in CPDF_PatternCS::GetRGB(). BUG=chromium:847346 Change-Id: If994a91cdcd84b8977196256ee6926e20c4b74aa Reviewed-on: https://pdfium-review.googlesource.com/33210 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- core/fpdfapi/render/cpdf_renderstatus.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index d63d321b9f..af976903be 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -2646,17 +2646,19 @@ FX_ARGB CPDF_RenderStatus::GetBackColor(const CPDF_Dictionary* pSMaskDict, const CPDF_Object* pCSObj = nullptr; const CPDF_Dictionary* pGroup = pGroupDict ? pGroupDict->GetDictFor("Group") : nullptr; - if (pGroup) { - // TODO(thestig): Check if "CS" is from PDF spec 1.7, table 13. - pCSObj = pGroup->GetDirectObjectFor("CS"); - } + if (pGroup) + pCSObj = pGroup->GetDirectObjectFor(pdfium::transparency::kCS); const CPDF_ColorSpace* pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); if (!pCS) return kDefaultColor; + int family = pCS->GetFamily(); + if (family == PDFCS_LAB || family == PDFCS_ICCBASED || pCS->IsSpecial()) + return kDefaultColor; + // Store Color Space Family to use in CPDF_RenderStatus::Initialize(). - *pCSFamily = pCS->GetFamily(); + *pCSFamily = family; uint32_t comps = std::max(8u, pCS->CountComponents()); std::vector floats(comps); -- cgit v1.2.3