Kaydet (Commit) 48c3eb3c authored tarafından Caolán McNamara's avatar Caolán McNamara

detect infinite recurse in object creation

Change-Id: Ie56eb27bb1827860b2600a5586e866e39cd31518
üst 0bfa6ddc
...@@ -701,7 +701,12 @@ rtl::Reference<LwpObject> LwpObjectFactory::QueryObject(const LwpObjectID &objID ...@@ -701,7 +701,12 @@ rtl::Reference<LwpObject> LwpObjectFactory::QueryObject(const LwpObjectID &objID
return nullptr; 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); obj = CreateObject(objHdr.GetTag(), objHdr);
m_aObjsIDInCreation.pop_back();
} }
return obj; return obj;
} }
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include "lwpidxmgr.hxx" #include "lwpidxmgr.hxx"
#include <unordered_map> #include <unordered_map>
#include <vector>
/** /**
* @brief object factory used for lwp object creation and maintenance * @brief object factory used for lwp object creation and maintenance
...@@ -85,9 +86,9 @@ public: ...@@ -85,9 +86,9 @@ public:
//For object Factory and object manager //For object Factory and object manager
private: private:
// static LwpObjectFactory *m_pMgr;
sal_uInt32 m_nNumObjs; sal_uInt32 m_nNumObjs;
LwpSvStream* m_pSvStream; LwpSvStream* m_pSvStream;
std::vector<LwpObjectID> m_aObjsIDInCreation;
struct hashFunc struct hashFunc
{ {
size_t operator()( const LwpObjectID& rName ) const size_t operator()( const LwpObjectID& rName ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment