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

Unified Diff: core/src/fxge/dib/fx_dib_convert.cpp

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 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 | « core/src/fxge/dib/fx_dib_composite.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/dib/fx_dib_convert.cpp
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index dacc43db6466e296c2c098d4484f184b2ccd85a7..4a8befe5e3d9ea4561334f7dd787e66e7aaef8d7 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -236,6 +236,9 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type)
FX_Free(m_pPalette);
}
m_pPalette = FX_Alloc(FX_DWORD, 256);
+ if (!m_pPalette) {
+ return FALSE;
+ }
int bpp = pBitmap->GetBPP() / 8;
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
@@ -248,7 +251,13 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type)
m_aLut = NULL;
}
m_cLut = FX_Alloc(FX_DWORD, 4096);
+ if (!m_cLut) {
+ return FALSE;
+ }
m_aLut = FX_Alloc(FX_DWORD, 4096);
+ if (!m_aLut) {
+ return FALSE;
+ }
int row, col;
m_lut = 0;
for (row = 0; row < height; row++) {
@@ -859,6 +868,9 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, FX_LPBYTE dest_buf, int dest_pit
return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
}
d_pal = FX_Alloc(FX_DWORD, 256);
+ if (!d_pal) {
+ return FALSE;
+ }
if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pSrcBitmap->GetPalette()) {
return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
} else if ((src_format & 0xff) >= 24) {
« no previous file with comments | « core/src/fxge/dib/fx_dib_composite.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698