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

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

Issue 662063003: Change the clear order of pDocPage and pDocRender (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 2 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 extern FX_LPVOID PDFPreviewInitCache(CPDF_Document* pDoc); 9 extern FX_LPVOID PDFPreviewInitCache(CPDF_Document* pDoc);
10 extern void PDFPreviewClearCache(FX_LPVOID pCache); 10 extern void PDFPreviewClearCache(FX_LPVOID pCache);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 m_dwFirstPageObjNum = pObjNum->GetInteger(); 88 m_dwFirstPageObjNum = pObjNum->GetInteger();
89 } 89 }
90 } 90 }
91 void CPDF_Document::LoadPages() 91 void CPDF_Document::LoadPages()
92 { 92 {
93 m_PageList.SetSize(_GetPageCount()); 93 m_PageList.SetSize(_GetPageCount());
94 } 94 }
95 extern void FPDF_TTFaceMapper_ReleaseDoc(CPDF_Document*); 95 extern void FPDF_TTFaceMapper_ReleaseDoc(CPDF_Document*);
96 CPDF_Document::~CPDF_Document() 96 CPDF_Document::~CPDF_Document()
97 { 97 {
98 if (m_pDocRender) {
99 CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender);
100 }
101 if (m_pDocPage) { 98 if (m_pDocPage) {
102 CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); 99 CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this);
103 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); 100 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
104 } 101 }
102 if (m_pDocRender) {
Tom Sepez 2014/10/21 21:05:29 Are you sure this doesn't introduce new UAFs from
Bo Xu 2014/10/21 21:19:42 Hi Tom, I have the same question and checked the d
103 CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender);
104 }
105 } 105 }
106 #define FX_MAX_PAGE_LEVEL 1024 106 #define FX_MAX_PAGE_LEVEL 1024
107 CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, int iPage, int nPagesToGo, int level) 107 CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, int iPage, int nPagesToGo, int level)
108 { 108 {
109 CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids")); 109 CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids"));
110 if (pKidList == NULL) { 110 if (pKidList == NULL) {
111 if (nPagesToGo == 0) { 111 if (nPagesToGo == 0) {
112 return pPages; 112 return pPages;
113 } 113 }
114 return NULL; 114 return NULL;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (m_pDocPage) { 394 if (m_pDocPage) {
395 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 395 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
396 } 396 }
397 } 397 }
398 void CPDF_Document::ClearRenderData() 398 void CPDF_Document::ClearRenderData()
399 { 399 {
400 if (m_pDocRender) { 400 if (m_pDocRender) {
401 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 401 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
402 } 402 }
403 } 403 }
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