summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-12-18 20:15:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-18 20:15:43 +0000
commitf1d8442ec2b063ec4da7ab129a67ec3f39278dee (patch)
treef1e43c2364469e85391396e7b8cfb35ec4ad09d3
parenta8fdbe4595a991436796244d1a577b6239866e53 (diff)
downloadpdfium-f1d8442ec2b063ec4da7ab129a67ec3f39278dee.tar.xz
[Merge M64] Validate shading pattern's ColorSpace. It cannot be a Pattern CS.
Bug: chromium:795251 Change-Id: I6c4fd75a5afd16ced499d031f9b535f8c6828854 Reviewed-on: https://pdfium-review.googlesource.com/21410 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> (cherry picked from commit 3208356db199098d1110780e138b74b6436deb0b) Reviewed-on: https://pdfium-review.googlesource.com/21610 Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp
index 542c4051c5..585a925ba7 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp
@@ -89,6 +89,11 @@ bool CPDF_ShadingPattern::Load() {
CPDF_DocPageData* pDocPageData = document()->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, nullptr);
+ // 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;
+
if (m_pCS)
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());