diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-19 14:56:52 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-19 14:56:52 -0700 |
commit | bf4aa2cc93a67826247e887b2ba26a1b965eb616 (patch) | |
tree | a1d6336676d6d70467a7fb94aa0e625b1dbc8c25 /core/src/fxcodec/codec/fx_codec_fax.cpp | |
parent | eb6527763171cdb4b0fbfea5a20d691f4d67b660 (diff) | |
download | pdfium-bf4aa2cc93a67826247e887b2ba26a1b965eb616.tar.xz |
Revert "Remove FX_Alloc() null checks now that it can't return NULL."
This reverts commit eb6527763171cdb4b0fbfea5a20d691f4d67b660.
Reason for revert: broke javascript tests.
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1145843005
Diffstat (limited to 'core/src/fxcodec/codec/fx_codec_fax.cpp')
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_fax.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index dc2ee2aacd..33e89e4f92 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -622,7 +622,13 @@ FX_BOOL CCodec_FaxDecoder::Create(FX_LPCBYTE src_buf, FX_DWORD src_size, int wid m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch); + if (m_pScanlineBuf == NULL) { + return FALSE; + } m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch); + if (m_pRefBuf == NULL) { + return FALSE; + } m_pSrcBuf = src_buf; m_SrcSize = src_size; m_nComps = 1; @@ -699,6 +705,9 @@ extern "C" { pitch = (width + 7) / 8; } FX_LPBYTE ref_buf = FX_Alloc(FX_BYTE, pitch); + if (ref_buf == NULL) { + return; + } FXSYS_memset8(ref_buf, 0xff, pitch); int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow ++) { @@ -936,6 +945,9 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(FX_LPCBYTE src_buf, int width, int height, m_Rows = height; m_Pitch = pitch; m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch); + if (m_pRefLine == NULL) { + return; + } FXSYS_memset8(m_pRefLine, 0xff, m_Pitch); m_pLineBuf = FX_Alloc2D(FX_BYTE, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); |