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

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

Issue 454283002: Fix the issue 'SEGV on unknown address in CPDF_DataAvail::GetObjectSize' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 return TRUE; 4100 return TRUE;
4101 } 4101 }
4102 m_pDocument->LoadPages(); 4102 m_pDocument->LoadPages();
4103 return FALSE; 4103 return FALSE;
4104 } 4104 }
4105 FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints) 4105 FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints)
4106 { 4106 {
4107 if (m_bLinearedDataOK) { 4107 if (m_bLinearedDataOK) {
4108 return TRUE; 4108 return TRUE;
4109 } 4109 }
4110 if (!m_pFileAvail->IsDataAvail(m_dwLastXRefOffset, (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset))) { 4110 if (!m_pFileAvail->IsDataAvail(m_dwLastXRefOffset, (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset))) {
Tom Sepez 2014/08/09 17:55:36 Is this going to change on subsequent calls? In o
jun_fang 2014/08/18 06:58:00 If IsDataAvail returns FALSE, that means that data
4111 pHints->AddSegment(m_dwLastXRefOffset, (FX_DWORD)(m_dwFileLen - m_dwLast XRefOffset)); 4111 pHints->AddSegment(m_dwLastXRefOffset, (FX_DWORD)(m_dwFileLen - m_dwLast XRefOffset));
4112 return FALSE; 4112 return FALSE;
4113 } 4113 }
4114 FX_DWORD dwRet = 0; 4114 FX_DWORD dwRet = 0;
4115 if (!m_bMainXRefLoad) { 4115 if (!m_bMainXRefLoad) {
Tom Sepez 2014/08/09 17:55:36 does m_bMainXRefLoad mean "main xref load succeede
jun_fang 2014/08/18 06:58:00 if |m_bMainXRefLoad| is true, it means that xref i
palmer 2014/08/19 20:26:41 In that case, I would call it |m_bMainXRefLoadSucc
4116 dwRet = ((CPDF_Parser *)m_pDocument->GetParser())->LoadLinearizedMainXRe fTable(); 4116 dwRet = ((CPDF_Parser *)m_pDocument->GetParser())->LoadLinearizedMainXRe fTable();
4117 if (dwRet == PDFPARSE_ERROR_SUCCESS) { 4117 if (dwRet != PDFPARSE_ERROR_SUCCESS) {
4118 if (!PreparePageItem()) { 4118 return FALSE;
4119 return FALSE;
4120 }
4121 m_bMainXRefLoadedOK = TRUE;
4122 } 4119 }
4120 if (!PreparePageItem()) {
4121 return FALSE;
4122 }
4123 m_bMainXRefLoadedOK = TRUE;
Tom Sepez 2014/08/09 17:55:36 What's the difference between m_bMainXrefLoadedOK
jun_fang 2014/08/18 06:58:00 They are different. |m_bMainXrefLoadedOK is true|
palmer 2014/08/19 20:26:41 Wait, then what does |m_bMainXRefLoad| mean that i
4123 m_bMainXRefLoad = TRUE; 4124 m_bMainXRefLoad = TRUE;
4124 } 4125 }
4125 m_bLinearedDataOK = TRUE; 4126 m_bLinearedDataOK = TRUE;
4126 return TRUE; 4127 return TRUE;
4127 } 4128 }
4128 FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint s) 4129 FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint s)
4129 { 4130 {
4130 if (!m_objs_array.GetSize()) { 4131 if (!m_objs_array.GetSize()) {
4131 m_objs_array.RemoveAll(); 4132 m_objs_array.RemoveAll();
4132 m_objnum_array.RemoveAll(); 4133 m_objnum_array.RemoveAll();
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
4405 { 4406 {
4406 FX_INT32 iSize = m_childNode.GetSize(); 4407 FX_INT32 iSize = m_childNode.GetSize();
4407 for (FX_INT32 i = 0; i < iSize; ++i) { 4408 for (FX_INT32 i = 0; i < iSize; ++i) {
4408 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4409 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4409 if (pNode) { 4410 if (pNode) {
4410 delete pNode; 4411 delete pNode;
4411 } 4412 }
4412 } 4413 }
4413 m_childNode.RemoveAll(); 4414 m_childNode.RemoveAll();
4414 } 4415 }
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