Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |