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

Unified Diff: core/src/fxcodec/codec/fx_codec_jbig.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/fxcodec/codec/fx_codec_icc.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpx_opj.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/codec/fx_codec_jbig.cpp
diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp
index 8fcd9f47116e95ebf71c4d3484071ac2a815a4b2..278d9cbcf60105311cda7335f0d964d67e7f000f 100644
--- a/core/src/fxcodec/codec/fx_codec_jbig.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp
@@ -53,6 +53,9 @@ FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr,
CJBig2_Image* dest_image = NULL;
FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize();
FX_LPBYTE src_buf = FX_Alloc(FX_BYTE, src_size);
+ if (src_buf == NULL) {
+ return FALSE;
+ }
int ret = 0;
if(!file_ptr->ReadBlock(src_buf, 0, src_size)) {
goto failed;
@@ -130,6 +133,9 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead
m_pJbig2Context->m_dest_image = NULL;
m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize();
m_pJbig2Context->m_src_buf = FX_Alloc(FX_BYTE, m_pJbig2Context->m_src_size);
+ if (m_pJbig2Context->m_src_buf == NULL) {
+ return FXCODEC_STATUS_ERR_MEMORY;
+ }
int ret = 0;
if(!file_ptr->ReadBlock((void*)m_pJbig2Context->m_src_buf, 0, m_pJbig2Context->m_src_size)) {
goto failed;
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_icc.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpx_opj.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698