summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-10 20:56:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-10 21:31:15 +0000
commit48c3eb3c91fd98c313bcec18f24cc949d6e788b3 (patch)
treed742a13c3e9c5be388fe80d594834a9219abe8dc /lotuswordpro
parent0bfa6ddc99710c1e166140f97cf3212348d04d05 (diff)
detect infinite recurse in object creation
Change-Id: Ie56eb27bb1827860b2600a5586e866e39cd31518
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.cxx5
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.hxx3
2 files changed, 7 insertions, 1 deletions
diff --git a/lotuswordpro/source/filter/lwpobjfactory.cxx b/lotuswordpro/source/filter/lwpobjfactory.cxx
index b58989908155..127770bd8d5d 100644
--- a/lotuswordpro/source/filter/lwpobjfactory.cxx
+++ b/lotuswordpro/source/filter/lwpobjfactory.cxx
@@ -701,7 +701,12 @@ rtl::Reference<LwpObject> LwpObjectFactory::QueryObject(const LwpObjectID &objID
return nullptr;
}
+ if (std::find(m_aObjsIDInCreation.begin(), m_aObjsIDInCreation.end(), objID) != m_aObjsIDInCreation.end())
+ throw std::runtime_error("recursion in object creation");
+
+ m_aObjsIDInCreation.push_back(objID);
obj = CreateObject(objHdr.GetTag(), objHdr);
+ m_aObjsIDInCreation.pop_back();
}
return obj;
}
diff --git a/lotuswordpro/source/filter/lwpobjfactory.hxx b/lotuswordpro/source/filter/lwpobjfactory.hxx
index 426307c8251e..6d84f5c0d31f 100644
--- a/lotuswordpro/source/filter/lwpobjfactory.hxx
+++ b/lotuswordpro/source/filter/lwpobjfactory.hxx
@@ -72,6 +72,7 @@
#include "lwpidxmgr.hxx"
#include <unordered_map>
+#include <vector>
/**
* @brief object factory used for lwp object creation and maintenance
@@ -85,9 +86,9 @@ public:
//For object Factory and object manager
private:
-// static LwpObjectFactory *m_pMgr;
sal_uInt32 m_nNumObjs;
LwpSvStream* m_pSvStream;
+ std::vector<LwpObjectID> m_aObjsIDInCreation;
struct hashFunc
{
size_t operator()( const LwpObjectID& rName ) const