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

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: 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..52a6f817f525440b07634f21f1b303399d3d2075 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -570,9 +570,12 @@ 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_pColorSpace &&
+ m_pColorSpace->CountComponents() != m_nComponents)
+ return 0;
if (m_Family == PDFCS_LAB && m_nComponents != 3) {
Tom Sepez 2016/04/15 20:14:49 nit: no {}
Oliver Chang 2016/04/15 20:40:26 Done.
- m_pCompData = nullptr;
return 0;
}
m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
« 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