diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-15 16:30:52 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-15 16:30:52 -0700 |
commit | ed099befbb300d6f9c393cb415fdb2a68c2ef471 (patch) | |
tree | 58516c42af12b16c521b6f1fdee5b8f059a262c0 /core/src/fxge | |
parent | 917c7fa7ccb5b7d5a9d89e717357f0ac6dfb9aa9 (diff) | |
download | pdfium-ed099befbb300d6f9c393cb415fdb2a68c2ef471.tar.xz |
Merge to XFA: Abort on OOM by default in FX_Alloc().
Original Review URL: https://codereview.chromium.org/1128043009
Original Review URL: https://codereview.chromium.org/1142463005
R=thestig@chromium.org
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1144683002
Diffstat (limited to 'core/src/fxge')
-rw-r--r-- | core/src/fxge/dib/fx_dib_convert.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_engine.cpp | 8 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_main.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index cfcbc707cd..69432fde4d 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -1015,7 +1015,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, void* pIccTransfor } int dest_bpp = dest_format & 0xff; int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; - FX_LPBYTE dest_buf = FX_AllocNL(FX_BYTE, dest_pitch * m_Height + 4); + FX_LPBYTE dest_buf = FX_TryAlloc(FX_BYTE, dest_pitch * m_Height + 4); if (dest_buf == NULL) { return FALSE; } diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index f4c0ef16be..4d398d8c45 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -28,7 +28,7 @@ void CWeightTable::Calc(int dest_len, int dest_min, int dest_max, int src_len, i if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) { return; } - m_pWeightTables = FX_AllocNL(FX_BYTE, (dest_max - dest_min) * m_ItemSize + 4); + m_pWeightTables = FX_TryAlloc(FX_BYTE, (dest_max - dest_min) * m_ItemSize + 4); if (m_pWeightTables == NULL) { return; } @@ -202,7 +202,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d } size += 31; size = size / 32 * 4; - m_pDestScanline = FX_AllocNL(FX_BYTE, size); + m_pDestScanline = FX_TryAlloc(FX_BYTE, size); if (m_pDestScanline == NULL) { return; } @@ -311,7 +311,7 @@ FX_BOOL CStretchEngine::StartStretchHorz() if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) { return FALSE; } - m_pInterBuf = FX_AllocNL(unsigned char, m_SrcClip.Height() * m_InterPitch); + m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch); if (m_pInterBuf == NULL) { return FALSE; } @@ -321,7 +321,7 @@ FX_BOOL CStretchEngine::StartStretchHorz() return FALSE; } FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4; - m_pDestMaskScanline = FX_AllocNL(unsigned char, size); + m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); if (!m_pDestMaskScanline) { return FALSE; } diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 2cb41f62b7..d9e401897b 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -84,7 +84,7 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBY int size = pitch * height + 4; int oomlimit = _MAX_OOM_LIMIT_; if (oomlimit >= 0 && size >= oomlimit) { - m_pBuffer = FX_AllocNL(FX_BYTE, size); + m_pBuffer = FX_TryAlloc(FX_BYTE, size); } else { m_pBuffer = FX_Alloc(FX_BYTE, size); } |