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

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

Issue 2250533002: Fix stack overflow in object Clone() functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: change due to rebase 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_OBJECT_H_ 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_
9 9
10 #include <set>
11
10 #include "core/fxcrt/include/fx_string.h" 12 #include "core/fxcrt/include/fx_string.h"
11 #include "core/fxcrt/include/fx_system.h" 13 #include "core/fxcrt/include/fx_system.h"
12 14
13 class CPDF_Array; 15 class CPDF_Array;
14 class CPDF_Boolean; 16 class CPDF_Boolean;
15 class CPDF_Dictionary; 17 class CPDF_Dictionary;
16 class CPDF_Name; 18 class CPDF_Name;
17 class CPDF_Null; 19 class CPDF_Null;
18 class CPDF_Number; 20 class CPDF_Number;
19 class CPDF_Reference; 21 class CPDF_Reference;
(...skipping 12 matching lines...) Expand all
32 DICTIONARY, 34 DICTIONARY,
33 STREAM, 35 STREAM,
34 NULLOBJ, 36 NULLOBJ,
35 REFERENCE 37 REFERENCE
36 }; 38 };
37 39
38 virtual Type GetType() const = 0; 40 virtual Type GetType() const = 0;
39 uint32_t GetObjNum() const { return m_ObjNum; } 41 uint32_t GetObjNum() const { return m_ObjNum; }
40 uint32_t GetGenNum() const { return m_GenNum; } 42 uint32_t GetGenNum() const { return m_GenNum; }
41 43
42 virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0; 44 virtual CPDF_Object* Clone() const = 0;
Lei Zhang 2016/08/18 15:16:44 It would be good to document what the different Cl
Wei Li 2016/08/18 22:02:30 Done.
45 virtual CPDF_Object* CloneDeRef(bool bDirect) const;
Lei Zhang 2016/08/18 15:16:44 Does anyone override this?
Wei Li 2016/08/18 22:02:30 Not now, but it could be.
46 // Complex objects should implement their own CloneWithCheck()
47 // function to properly check for possible loop.
48 virtual CPDF_Object* CloneWithCheck(
49 bool bDirect,
50 std::set<const CPDF_Object*>* pVisited) const;
43 virtual CPDF_Object* GetDirect() const; 51 virtual CPDF_Object* GetDirect() const;
44 52
45 void Release(); 53 void Release();
46 54
47 virtual CFX_ByteString GetString() const; 55 virtual CFX_ByteString GetString() const;
48 virtual CFX_WideString GetUnicodeText() const; 56 virtual CFX_WideString GetUnicodeText() const;
49 virtual FX_FLOAT GetNumber() const; 57 virtual FX_FLOAT GetNumber() const;
50 virtual int GetInteger() const; 58 virtual int GetInteger() const;
51 virtual CPDF_Dictionary* GetDict() const; 59 virtual CPDF_Dictionary* GetDict() const;
52 60
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 159
152 inline CPDF_Stream* ToStream(CPDF_Object* obj) { 160 inline CPDF_Stream* ToStream(CPDF_Object* obj) {
153 return obj ? obj->AsStream() : nullptr; 161 return obj ? obj->AsStream() : nullptr;
154 } 162 }
155 163
156 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { 164 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) {
157 return obj ? obj->AsStream() : nullptr; 165 return obj ? obj->AsStream() : nullptr;
158 } 166 }
159 167
160 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ 168 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698