summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp8
2 files changed, 9 insertions, 4 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 5a9f1a8cb8..4ec753d751 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -204,10 +204,11 @@ 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);
- for (int i = 0; i < m_nChars; i ++) {
+ int i;
+ for (i = 0; i < m_nChars; i ++) {
m_pCharCodes[i] = pSrcObj->m_pCharCodes[i];
}
- for (int i = 0; i < m_nChars - 1; i ++) {
+ for (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 d8b24593ef..952fe1d9a9 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_buf = FX_Alloc2D(FX_BYTE, pitch, height);
- dest_size = pitch * height; // Safe since checked alloc returned.
+ dest_size = pitch * height;
+ dest_buf = FX_Alloc( FX_BYTE, dest_size);
for (int row = 0; row < height; row ++) {
FX_LPBYTE pLine = pDecoder->GetScanline(row);
if (pLine == NULL) {
@@ -1050,6 +1050,10 @@ 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());