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

Side by Side Diff: core/fpdfapi/parser/cpdf_document.h

Issue 2636403003: Bad indexing in CPDF_Document::FindPageIndex when page tree corrupt. (Closed)
Patch Set: return -1 for out-of-range Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
9 9
10 #include <functional> 10 #include <functional>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 bool bVert, 99 bool bVert,
100 bool bTranslateName = false); 100 bool bTranslateName = false);
101 #endif 101 #endif
102 102
103 protected: 103 protected:
104 // Retrieve page count information by getting count value from the tree nodes 104 // Retrieve page count information by getting count value from the tree nodes
105 int RetrievePageCount() const; 105 int RetrievePageCount() const;
106 // When this method is called, m_pTreeTraversal[level] exists. 106 // When this method is called, m_pTreeTraversal[level] exists.
107 CPDF_Dictionary* TraversePDFPages(int iPage, int* nPagesToGo, size_t level); 107 CPDF_Dictionary* TraversePDFPages(int iPage, int* nPagesToGo, size_t level);
108 int FindPageIndex(CPDF_Dictionary* pNode, 108 int FindPageIndex(CPDF_Dictionary* pNode,
109 uint32_t& skip_count, 109 uint32_t* skip_count,
110 uint32_t objnum, 110 uint32_t objnum,
111 int& index, 111 int* index,
112 int level = 0); 112 int level = 0);
113 std::unique_ptr<CPDF_Object> ParseIndirectObject(uint32_t objnum) override; 113 std::unique_ptr<CPDF_Object> ParseIndirectObject(uint32_t objnum) override;
114 void LoadDocInternal(); 114 void LoadDocInternal();
115 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict); 115 size_t CalculateEncodingDict(int charset, CPDF_Dictionary* pBaseDict);
116 CPDF_Dictionary* GetPagesDict() const; 116 CPDF_Dictionary* GetPagesDict() const;
117 CPDF_Dictionary* ProcessbCJK( 117 CPDF_Dictionary* ProcessbCJK(
118 CPDF_Dictionary* pBaseDict, 118 CPDF_Dictionary* pBaseDict,
119 int charset, 119 int charset,
120 bool bVert, 120 bool bVert,
121 CFX_ByteString basefont, 121 CFX_ByteString basefont,
(...skipping 22 matching lines...) Expand all
144 uint32_t m_dwFirstPageObjNum; 144 uint32_t m_dwFirstPageObjNum;
145 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. 145 // TODO(thestig): Figure out why this cannot be a std::unique_ptr.
146 CPDF_DocPageData* m_pDocPage; 146 CPDF_DocPageData* m_pDocPage;
147 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; 147 std::unique_ptr<CPDF_DocRenderData> m_pDocRender;
148 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; 148 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext;
149 std::unique_ptr<CPDF_LinkList> m_pLinksContext; 149 std::unique_ptr<CPDF_LinkList> m_pLinksContext;
150 std::vector<uint32_t> m_PageList; 150 std::vector<uint32_t> m_PageList;
151 }; 151 };
152 152
153 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_ 153 #endif // CORE_FPDFAPI_PARSER_CPDF_DOCUMENT_H_
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/parser/cpdf_document.cpp » ('j') | core/fpdfapi/parser/cpdf_document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698