summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-08-21 15:19:00 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-08-21 15:19:00 -0700
commit4fb24f37072ebe6bac88ef5c56a7bbcb444c8aec (patch)
tree207e693a857d747df68a6a01fd25f68c8f9560bd /core/src/fpdfapi/fpdf_page
parent8f2c3dc95a6a42ea52d923457a688a6db1c4aace (diff)
downloadpdfium-4fb24f37072ebe6bac88ef5c56a7bbcb444c8aec.tar.xz
For pattern colorspace, its base colorspace should not be a pattern colorspace
BUG=405588 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/496883002
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 1b4e7b83a9..c0a5602819 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -843,6 +843,9 @@ FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL);
if (m_pBaseCS) {
+ if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
+ return FALSE;
+ }
m_nComponents = m_pBaseCS->CountComponents() + 1;
if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
return FALSE;
@@ -855,9 +858,11 @@ FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
FX_BOOL CPDF_PatternCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_pBaseCS) {
+ ASSERT(m_pBaseCS->GetFamily() != PDFCS_PATTERN);
PatternValue* pvalue = (PatternValue*)pBuf;
- m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B);
- return TRUE;
+ if (m_pBaseCS->GetRGB(pvalue->m_Comps, R, G, B)) {
+ return TRUE;
+ }
}
R = G = B = 0.75f;
return FALSE;