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

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

Issue 579363002: Fix Regression: Incomplete file loading is seen for multi page pdf files. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: untabify Created 6 years, 3 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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 CPDF_Object* pStartNumObj = NULL; 1035 CPDF_Object* pStartNumObj = NULL;
1036 CPDF_Object* pCountObj = NULL; 1036 CPDF_Object* pCountObj = NULL;
1037 for (FX_DWORD i = 0; i < nPairSize; i++) { 1037 for (FX_DWORD i = 0; i < nPairSize; i++) {
1038 pStartNumObj = pArray->GetElement(i * 2); 1038 pStartNumObj = pArray->GetElement(i * 2);
1039 pCountObj = pArray->GetElement(i * 2 + 1); 1039 pCountObj = pArray->GetElement(i * 2 + 1);
1040 if (pStartNumObj && pStartNumObj->GetType() == PDFOBJ_NUMBER 1040 if (pStartNumObj && pStartNumObj->GetType() == PDFOBJ_NUMBER
1041 && pCountObj && pCountObj->GetType() == PDFOBJ_NUMBER) { 1041 && pCountObj && pCountObj->GetType() == PDFOBJ_NUMBER) {
1042 arrIndex.push_back(std::make_pair(pStartNumObj->GetInteger(), pC ountObj->GetInteger())); 1042 arrIndex.push_back(std::make_pair(pStartNumObj->GetInteger(), pC ountObj->GetInteger()));
1043 } 1043 }
1044 } 1044 }
1045 nSegs = arrIndex.size(); 1045 } else {
1046 if (nSegs == 0) { 1046 arrIndex.push_back(std::make_pair(0, size));
1047 arrIndex.push_back(std::make_pair(0, size));
1048 nSegs = 1;
1049 }
1050 } 1047 }
1048 nSegs = arrIndex.size();
jun_fang 2014/09/18 18:00:22 arrIndex may be empty here. If it's empty, we shou
1051 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); 1049 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W"));
1052 if (pArray == NULL) { 1050 if (pArray == NULL) {
1053 pStream->Release(); 1051 pStream->Release();
1054 return FALSE; 1052 return FALSE;
1055 } 1053 }
1056 CFX_DWordArray WidthArray; 1054 CFX_DWordArray WidthArray;
1057 FX_SAFE_DWORD dwAccWidth = 0; 1055 FX_SAFE_DWORD dwAccWidth = 0;
1058 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { 1056 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) {
1059 WidthArray.Add(pArray->GetInteger(i)); 1057 WidthArray.Add(pArray->GetInteger(i));
1060 dwAccWidth += WidthArray[i]; 1058 dwAccWidth += WidthArray[i];
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after
4436 { 4434 {
4437 FX_INT32 iSize = m_childNode.GetSize(); 4435 FX_INT32 iSize = m_childNode.GetSize();
4438 for (FX_INT32 i = 0; i < iSize; ++i) { 4436 for (FX_INT32 i = 0; i < iSize; ++i) {
4439 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4437 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4440 if (pNode) { 4438 if (pNode) {
4441 delete pNode; 4439 delete pNode;
4442 } 4440 }
4443 } 4441 }
4444 m_childNode.RemoveAll(); 4442 m_childNode.RemoveAll();
4445 } 4443 }
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