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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/fpdf_parser/include/cpdf_object.h
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
index 86f3879ce1fffa3243c01cf6c59f04512d72c198..57fdb3abeaf40510b69ef9c9ccd63dbf814dce5f 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
@@ -7,6 +7,8 @@
#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_
#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_
+#include <set>
+
#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
@@ -39,7 +41,13 @@ class CPDF_Object {
uint32_t GetObjNum() const { return m_ObjNum; }
uint32_t GetGenNum() const { return m_GenNum; }
- virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0;
+ 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.
+ 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.
+ // Complex objects should implement their own CloneWithCheck()
+ // function to properly check for possible loop.
+ virtual CPDF_Object* CloneWithCheck(
+ bool bDirect,
+ std::set<const CPDF_Object*>* pVisited) const;
virtual CPDF_Object* GetDirect() const;
void Release();

Powered by Google App Engine
This is Rietveld 408576698