Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1892143003: Prevent a potential OOB read in TranslateImageLine. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: nits Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_render/fpdf_render_loadimage_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 951d38359f6b3bfcb2dfe0c6f3c85727d8898811..44ac29f9e160dd0d9b39472021da13eca24deeca 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -570,15 +570,16 @@ int CPDF_DIBSource::CreateDecoder() {
bpc, bTransform)) {
if (m_nComponents != static_cast<uint32_t>(comps)) {
FX_Free(m_pCompData);
+ m_pCompData = nullptr;
m_nComponents = static_cast<uint32_t>(comps);
- if (m_Family == PDFCS_LAB && m_nComponents != 3) {
- m_pCompData = nullptr;
+ if (m_pColorSpace &&
+ m_pColorSpace->CountComponents() != m_nComponents)
+ return 0;
+ if (m_Family == PDFCS_LAB && m_nComponents != 3)
return 0;
- }
m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
- if (!m_pCompData) {
+ if (!m_pCompData)
return 0;
- }
}
m_bpc = bpc;
m_pDecoder.reset(CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_render/fpdf_render_loadimage_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698