diff options
Diffstat (limited to 'core/fpdfapi/page/cpdf_docpagedata.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_docpagedata.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index 71143d0b6c..1af9d6ee22 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -212,10 +212,10 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace( CPDF_Object* pCSObj, const CPDF_Dictionary* pResources) { std::set<CPDF_Object*> visited; - return GetColorSpaceImpl(pCSObj, pResources, &visited); + return GetColorSpaceGuarded(pCSObj, pResources, &visited); } -CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl( +CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceGuarded( CPDF_Object* pCSObj, const CPDF_Dictionary* pResources, std::set<CPDF_Object*>* pVisited) { @@ -225,15 +225,16 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl( if (pdfium::ContainsKey(*pVisited, pCSObj)) return nullptr; + pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj); + if (pCSObj->IsName()) { CFX_ByteString name = pCSObj->GetString(); CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name); if (!pCS && pResources) { CPDF_Dictionary* pList = pResources->GetDictFor("ColorSpace"); if (pList) { - pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj); - return GetColorSpaceImpl(pList->GetDirectObjectFor(name), nullptr, - pVisited); + return GetColorSpaceGuarded(pList->GetDirectObjectFor(name), nullptr, + pVisited); } } if (!pCS || !pResources) @@ -258,8 +259,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl( if (!pDefaultCS) return pCS; - pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj); - return GetColorSpaceImpl(pDefaultCS, nullptr, pVisited); + return GetColorSpaceGuarded(pDefaultCS, nullptr, pVisited); } CPDF_Array* pArray = pCSObj->AsArray(); @@ -267,9 +267,8 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl( return nullptr; if (pArray->GetCount() == 1) { - pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj); - return GetColorSpaceImpl(pArray->GetDirectObjectAt(0), pResources, - pVisited); + return GetColorSpaceGuarded(pArray->GetDirectObjectAt(0), pResources, + pVisited); } CPDF_CountedColorSpace* csData = nullptr; @@ -282,7 +281,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl( } std::unique_ptr<CPDF_ColorSpace> pCS = - CPDF_ColorSpace::Load(m_pPDFDoc.Get(), pArray); + CPDF_ColorSpace::Load(m_pPDFDoc.Get(), pArray, pVisited); if (!pCS) return nullptr; |