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

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

Issue 2250533002: Fix stack overflow in object Clone() functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase again Created 4 years, 4 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_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_
9 9
10 #include <set>
10 #include <vector> 11 #include <vector>
11 12
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h"
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
14 #include "core/fxcrt/include/fx_basic.h" 15 #include "core/fxcrt/include/fx_basic.h"
15 #include "core/fxcrt/include/fx_coordinates.h" 16 #include "core/fxcrt/include/fx_coordinates.h"
16 17
17 class CPDF_Array : public CPDF_Object { 18 class CPDF_Array : public CPDF_Object {
18 public: 19 public:
19 using iterator = std::vector<CPDF_Object*>::iterator; 20 using iterator = std::vector<CPDF_Object*>::iterator;
20 using const_iterator = std::vector<CPDF_Object*>::const_iterator; 21 using const_iterator = std::vector<CPDF_Object*>::const_iterator;
21 22
22 CPDF_Array(); 23 CPDF_Array();
23 24
24 // CPDF_Object. 25 // CPDF_Object.
25 Type GetType() const override; 26 Type GetType() const override;
26 CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; 27 CPDF_Object* Clone() const override;
27 bool IsArray() const override; 28 bool IsArray() const override;
28 CPDF_Array* AsArray() override; 29 CPDF_Array* AsArray() override;
29 const CPDF_Array* AsArray() const override; 30 const CPDF_Array* AsArray() const override;
30 31
31 bool IsEmpty() const { return m_Objects.empty(); } 32 bool IsEmpty() const { return m_Objects.empty(); }
32 size_t GetCount() const { return m_Objects.size(); } 33 size_t GetCount() const { return m_Objects.size(); }
33 CPDF_Object* GetObjectAt(size_t index) const; 34 CPDF_Object* GetObjectAt(size_t index) const;
34 CPDF_Object* GetDirectObjectAt(size_t index) const; 35 CPDF_Object* GetDirectObjectAt(size_t index) const;
35 CFX_ByteString GetStringAt(size_t index) const; 36 CFX_ByteString GetStringAt(size_t index) const;
36 int GetIntegerAt(size_t index) const; 37 int GetIntegerAt(size_t index) const;
(...skipping 24 matching lines...) Expand all
61 } 62 }
62 63
63 iterator begin() { return m_Objects.begin(); } 64 iterator begin() { return m_Objects.begin(); }
64 iterator end() { return m_Objects.end(); } 65 iterator end() { return m_Objects.end(); }
65 const_iterator begin() const { return m_Objects.begin(); } 66 const_iterator begin() const { return m_Objects.begin(); }
66 const_iterator end() const { return m_Objects.end(); } 67 const_iterator end() const { return m_Objects.end(); }
67 68
68 protected: 69 protected:
69 ~CPDF_Array() override; 70 ~CPDF_Array() override;
70 71
72 CPDF_Object* CloneNonCyclic(
73 bool bDirect,
74 std::set<const CPDF_Object*>* pVisited) const override;
75
71 std::vector<CPDF_Object*> m_Objects; 76 std::vector<CPDF_Object*> m_Objects;
72 }; 77 };
73 78
74 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ 79 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_string.cpp ('k') | core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698