diff options
author | Lei Zhang <thestig@google.com> | 2014-12-15 22:23:38 -0800 |
---|---|---|
committer | Lei Zhang <thestig@google.com> | 2014-12-15 22:23:38 -0800 |
commit | e3b5c78dfff9575f9253547bf81fd16902ebb78b (patch) | |
tree | 99817530ac7a69d4a5f1b80bf039443c413df01b | |
parent | 0e46ce2948c8b45e9e5adcf6c4cb27620d5ba8ae (diff) | |
download | pdfium-e3b5c78dfff9575f9253547bf81fd16902ebb78b.tar.xz |
Lab colorspace needs to be 3 component
BUG=429134
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/791223002
(cherry picked from commit 381b911795bb42295e61976b0df3d7e46b780d02)
Review URL: https://codereview.chromium.org/807093002
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 1 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 5266c1a052..670465673b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -456,6 +456,7 @@ FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) } void CPDF_LabCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const { + assert(iComponent < 3); value = 0; if (iComponent == 0) { min = 0; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index d2910dc1ab..c5a96d67f4 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -583,6 +583,10 @@ int CPDF_DIBSource::CreateDecoder() if (m_nComponents != comps) { FX_Free(m_pCompData); m_nComponents = comps; + if (m_Family == PDFCS_LAB && m_nComponents != 3) { + m_pCompData = NULL; + return 0; + } m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); if (m_pCompData == NULL) { return 0; |