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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 379273002: Fix a null object bug (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_page.h" 9 #include "../../../include/fpdfapi/fpdf_page.h"
10 #include "../../../../third_party/numerics/safe_math.h" 10 #include "../../../../third_party/numerics/safe_math.h"
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 return pRet; 1204 return pRet;
1205 } 1205 }
1206 return NULL; 1206 return NULL;
1207 } 1207 }
1208 CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) 1208 CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum)
1209 { 1209 {
1210 CPDF_StreamAcc* pStreamAcc = NULL; 1210 CPDF_StreamAcc* pStreamAcc = NULL;
1211 if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) { 1211 if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) {
1212 return pStreamAcc; 1212 return pStreamAcc;
1213 } 1213 }
1214 const CPDF_Stream* pStream = (CPDF_Stream*)m_pDocument->GetIndirectObject(ob jnum); 1214 const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetInd irectObject(objnum) : NULL;
1215 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { 1215 if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
1216 return NULL; 1216 return NULL;
1217 } 1217 }
1218 pStreamAcc = FX_NEW CPDF_StreamAcc; 1218 pStreamAcc = FX_NEW CPDF_StreamAcc;
1219 pStreamAcc->LoadAllData(pStream); 1219 pStreamAcc->LoadAllData(pStream);
1220 m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc); 1220 m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc);
1221 return pStreamAcc; 1221 return pStreamAcc;
1222 } 1222 }
1223 FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) 1223 FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum)
1224 { 1224 {
(...skipping 3159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4384 { 4384 {
4385 FX_INT32 iSize = m_childNode.GetSize(); 4385 FX_INT32 iSize = m_childNode.GetSize();
4386 for (FX_INT32 i = 0; i < iSize; ++i) { 4386 for (FX_INT32 i = 0; i < iSize; ++i) {
4387 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4387 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4388 if (pNode) { 4388 if (pNode) {
4389 delete pNode; 4389 delete pNode;
4390 } 4390 }
4391 } 4391 }
4392 m_childNode.RemoveAll(); 4392 m_childNode.RemoveAll();
4393 } 4393 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698