diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-19 15:19:32 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-19 15:19:32 -0700 |
commit | 981a3468319eb24e696bb64ba84d9631fd26f1f7 (patch) | |
tree | c1136b807975ccc80199ff6593e69475261c1670 /core/src/fpdfapi/fpdf_page | |
parent | bf4aa2cc93a67826247e887b2ba26a1b965eb616 (diff) | |
download | pdfium-981a3468319eb24e696bb64ba84d9631fd26f1f7.tar.xz |
Re-land: Remove FX_Alloc() null checks now that it can't return NULL.
Fixes the ordering of some assignments broken when converting to checked
numerics in CFX_PathData::AddPointCount().
Original Review URL: https://codereview.chromium.org/1142713005
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1135893008
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 5 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 8 |
2 files changed, 4 insertions, 9 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 4ec753d751..5a9f1a8cb8 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -204,11 +204,10 @@ void CPDF_TextObject::CopyData(const CPDF_PageObject* pSrc) if (m_nChars > 1) { m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars); m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); - int i; - for (i = 0; i < m_nChars; i ++) { + for (int i = 0; i < m_nChars; i ++) { m_pCharCodes[i] = pSrcObj->m_pCharCodes[i]; } - for (i = 0; i < m_nChars - 1; i ++) { + for (int i = 0; i < m_nChars - 1; i ++) { m_pCharPos[i] = pSrcObj->m_pCharPos[i]; } } else { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 952fe1d9a9..d8b24593ef 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -262,8 +262,8 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b delete pDecoder; return -1; } - dest_size = pitch * height; - dest_buf = FX_Alloc( FX_BYTE, dest_size); + dest_buf = FX_Alloc2D(FX_BYTE, pitch, height); + dest_size = pitch * height; // Safe since checked alloc returned. for (int row = 0; row < height; row ++) { FX_LPBYTE pLine = pDecoder->GetScanline(row); if (pLine == NULL) { @@ -1050,10 +1050,6 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) m_Size += size + 1; } m_pData = FX_Alloc(FX_BYTE, m_Size); - if (!m_pData) { - m_Status = Done; - return; - } FX_DWORD pos = 0; for (i = 0; i < m_nStreams; i ++) { FXSYS_memcpy32(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize()); |