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

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

Issue 895933003: Fix segv in CPDF_DataAvail::CheckRoot() when /Root object is a string. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase. Created 5 years, 10 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 | fpdfsdk/src/fpdfview_embeddertest.cpp » ('j') | 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 "../../../src/fxcrt/fx_safe_types.h" 10 #include "../../../src/fxcrt/fx_safe_types.h"
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; 3383 m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
3384 return TRUE; 3384 return TRUE;
3385 } 3385 }
3386 if (!m_pRoot) { 3386 if (!m_pRoot) {
3387 if (m_docStatus == PDF_DATAAVAIL_ERROR) { 3387 if (m_docStatus == PDF_DATAAVAIL_ERROR) {
3388 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; 3388 m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
3389 return TRUE; 3389 return TRUE;
3390 } 3390 }
3391 return FALSE; 3391 return FALSE;
3392 } 3392 }
3393 CPDF_Reference* pRef = (CPDF_Reference*)m_pRoot->GetDict()->GetElement(FX_BS TRC("Pages")); 3393 CPDF_Dictionary* pDict = m_pRoot->GetDict();
3394 if (!pDict) {
3395 m_docStatus = PDF_DATAAVAIL_ERROR;
3396 return FALSE;
3397 }
3398 CPDF_Reference* pRef = (CPDF_Reference*)pDict->GetElement(FX_BSTRC("Pages")) ;
3394 if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) { 3399 if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) {
3395 m_docStatus = PDF_DATAAVAIL_ERROR; 3400 m_docStatus = PDF_DATAAVAIL_ERROR;
3396 return FALSE; 3401 return FALSE;
3397 } 3402 }
3398 m_PagesObjNum = pRef->GetRefObjNum(); 3403 m_PagesObjNum = pRef->GetRefObjNum();
3399 CPDF_Reference* pAcroFormRef = (CPDF_Reference*)m_pRoot->GetDict()->GetEleme nt(FX_BSTRC("AcroForm")); 3404 CPDF_Reference* pAcroFormRef = (CPDF_Reference*)m_pRoot->GetDict()->GetEleme nt(FX_BSTRC("AcroForm"));
3400 if (pAcroFormRef && pAcroFormRef->GetType() == PDFOBJ_REFERENCE) { 3405 if (pAcroFormRef && pAcroFormRef->GetType() == PDFOBJ_REFERENCE) {
3401 m_bHaveAcroForm = TRUE; 3406 m_bHaveAcroForm = TRUE;
3402 m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum(); 3407 m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum();
3403 } 3408 }
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
4638 { 4643 {
4639 FX_INT32 iSize = m_childNode.GetSize(); 4644 FX_INT32 iSize = m_childNode.GetSize();
4640 for (FX_INT32 i = 0; i < iSize; ++i) { 4645 for (FX_INT32 i = 0; i < iSize; ++i) {
4641 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4646 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4642 if (pNode) { 4647 if (pNode) {
4643 delete pNode; 4648 delete pNode;
4644 } 4649 }
4645 } 4650 }
4646 m_childNode.RemoveAll(); 4651 m_childNode.RemoveAll();
4647 } 4652 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/src/fpdfview_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698