diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-10 20:56:21 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-10 21:32:14 +0000 |
commit | dca46b983000472ee6d1f74507b8421e8c817312 (patch) | |
tree | 2248c9e8de5fe89085a0dccc2adcaf68f1841325 /lotuswordpro/source | |
parent | b6656993429cd18e8a31825de45c9515f93cd0cd (diff) |
detect infinite recurse in object creation
Change-Id: Ie56eb27bb1827860b2600a5586e866e39cd31518
(cherry picked from commit 48c3eb3c91fd98c313bcec18f24cc949d6e788b3)
Diffstat (limited to 'lotuswordpro/source')
-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 |