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

Side by Side Diff: core/fpdfapi/page/cpdf_streamparser.h

Issue 2686193003: [M57] Limit parsing recursion levels in CPDF_StreamParser (Closed)
Patch Set: Created 3 years, 10 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/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/page/cpdf_streamparser.cpp » ('j') | 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_PAGE_CPDF_STREAMPARSER_H_ 7 #ifndef CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 16 matching lines...) Expand all
27 const CFX_WeakPtr<CFX_ByteStringPool>& pPool); 27 const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
28 ~CPDF_StreamParser(); 28 ~CPDF_StreamParser();
29 29
30 SyntaxType ParseNextElement(); 30 SyntaxType ParseNextElement();
31 const uint8_t* GetWordBuf() const { return m_WordBuffer; } 31 const uint8_t* GetWordBuf() const { return m_WordBuffer; }
32 uint32_t GetWordSize() const { return m_WordSize; } 32 uint32_t GetWordSize() const { return m_WordSize; }
33 uint32_t GetPos() const { return m_Pos; } 33 uint32_t GetPos() const { return m_Pos; }
34 void SetPos(uint32_t pos) { m_Pos = pos; } 34 void SetPos(uint32_t pos) { m_Pos = pos; }
35 std::unique_ptr<CPDF_Object> GetObject() { return std::move(m_pLastObj); } 35 std::unique_ptr<CPDF_Object> GetObject() { return std::move(m_pLastObj); }
36 std::unique_ptr<CPDF_Object> ReadNextObject(bool bAllowNestedArray, 36 std::unique_ptr<CPDF_Object> ReadNextObject(bool bAllowNestedArray,
37 uint32_t dwInArrayLevel); 37 bool bInArray,
38 uint32_t dwRecursionLevel);
38 std::unique_ptr<CPDF_Stream> ReadInlineStream( 39 std::unique_ptr<CPDF_Stream> ReadInlineStream(
39 CPDF_Document* pDoc, 40 CPDF_Document* pDoc,
40 std::unique_ptr<CPDF_Dictionary> pDict, 41 std::unique_ptr<CPDF_Dictionary> pDict,
41 CPDF_Object* pCSObj); 42 CPDF_Object* pCSObj);
42 43
43 private: 44 private:
44 friend class cpdf_streamparser_ReadHexString_Test; 45 friend class cpdf_streamparser_ReadHexString_Test;
45 46
46 void GetNextWord(bool& bIsNumber); 47 void GetNextWord(bool& bIsNumber);
47 CFX_ByteString ReadString(); 48 CFX_ByteString ReadString();
48 CFX_ByteString ReadHexString(); 49 CFX_ByteString ReadHexString();
49 bool PositionIsInBounds() const; 50 bool PositionIsInBounds() const;
50 51
51 const uint8_t* m_pBuf; 52 const uint8_t* m_pBuf;
52 uint32_t m_Size; // Length in bytes of m_pBuf. 53 uint32_t m_Size; // Length in bytes of m_pBuf.
53 uint32_t m_Pos; // Current byte position within m_pBuf. 54 uint32_t m_Pos; // Current byte position within m_pBuf.
54 uint8_t m_WordBuffer[256]; 55 uint8_t m_WordBuffer[256];
55 uint32_t m_WordSize; 56 uint32_t m_WordSize;
56 std::unique_ptr<CPDF_Object> m_pLastObj; 57 std::unique_ptr<CPDF_Object> m_pLastObj;
57 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; 58 CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
58 }; 59 };
59 60
60 #endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_ 61 #endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/page/cpdf_streamparser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698