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

Side by Side Diff: core/fpdfapi/fpdf_parser/include/cpdf_parser.h

Issue 2283893003: Add some limit checks to ReadSharedObjHintTable(). (Closed)
Patch Set: Created 4 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 | « core/fpdfapi/fpdf_parser/cpdf_parser.cpp ('k') | 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 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_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 16 matching lines...) Expand all
27 class CPDF_Parser { 27 class CPDF_Parser {
28 public: 28 public:
29 enum Error { 29 enum Error {
30 SUCCESS = 0, 30 SUCCESS = 0,
31 FILE_ERROR, 31 FILE_ERROR,
32 FORMAT_ERROR, 32 FORMAT_ERROR,
33 PASSWORD_ERROR, 33 PASSWORD_ERROR,
34 HANDLER_ERROR 34 HANDLER_ERROR
35 }; 35 };
36 36
37 // A limit on the maximum object number in the xref table. Theoretical limits
38 // are higher, but this may be large enough in practice.
39 static const uint32_t kMaxObjectNumber = 1048576;
40
37 CPDF_Parser(); 41 CPDF_Parser();
38 ~CPDF_Parser(); 42 ~CPDF_Parser();
39 43
40 Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument); 44 Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument);
41 Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument); 45 Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument);
42 46
43 void SetPassword(const FX_CHAR* password) { m_Password = password; } 47 void SetPassword(const FX_CHAR* password) { m_Password = password; }
44 CFX_ByteString GetPassword() { return m_Password; } 48 CFX_ByteString GetPassword() { return m_Password; }
45 CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } 49 CPDF_Dictionary* GetTrailer() const { return m_pTrailer; }
46 FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } 50 FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Mapping of object numbers to offsets. The offsets are relative to the first 167 // Mapping of object numbers to offsets. The offsets are relative to the first
164 // object in the stream. 168 // object in the stream.
165 using StreamObjectCache = std::map<uint32_t, uint32_t>; 169 using StreamObjectCache = std::map<uint32_t, uint32_t>;
166 170
167 // Mapping of streams to their object caches. This is valid as long as the 171 // Mapping of streams to their object caches. This is valid as long as the
168 // streams in |m_ObjectStreamMap| are valid. 172 // streams in |m_ObjectStreamMap| are valid.
169 std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache; 173 std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache;
170 174
171 // All indirect object numbers that are being parsed. 175 // All indirect object numbers that are being parsed.
172 std::set<uint32_t> m_ParsingObjNums; 176 std::set<uint32_t> m_ParsingObjNums;
173
174
175 }; 177 };
176 178
177 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ 179 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_parser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698