diff options
-rw-r--r-- | lotuswordpro/source/filter/lwpobjfactory.cxx | 5 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpobjfactory.hxx | 3 |
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 |