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

guard against styles based on themselves

which leads to stack exhaustion when queries,

make m_BasedOnStyle private and replace it with
a call to GetBasedOnStyle which checks that
the base style is not itself

Change-Id: I093546793755f8a3a6e8a3c23fb8565ad27b75da
üst 80297dd0
...@@ -269,7 +269,7 @@ void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle) ...@@ -269,7 +269,7 @@ void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
if (!pLayoutNumerics) if (!pLayoutNumerics)
{ {
// if current layout doesn't have format, go to based on layout // if current layout doesn't have format, go to based on layout
LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(m_BasedOnStyle.obj().get()); LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(GetBasedOnStyle().get());
if (pCellLayout) if (pCellLayout)
{ {
pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get()); pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get());
...@@ -654,7 +654,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID) ...@@ -654,7 +654,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
else else
{ {
// judge base on // judge base on
LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj().get()); LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
if (pBase && pBase->IsProtected()) if (pBase && pBase->IsProtected())
{ {
bProtected = true; bProtected = true;
......
...@@ -321,6 +321,8 @@ public: ...@@ -321,6 +321,8 @@ public:
protected: protected:
void Read() override; void Read() override;
private:
LwpObjectID m_BasedOnStyle;
protected: protected:
enum enum
{ {
...@@ -329,8 +331,7 @@ protected: ...@@ -329,8 +331,7 @@ protected:
}; };
LwpObjectID m_Content; LwpObjectID m_Content;
LwpObjectID m_BasedOnStyle; rtl::Reference<LwpObject> GetBasedOnStyle();
LwpObjectID m_TabPiece; LwpObjectID m_TabPiece;
LwpLayoutStyle* m_pStyleStuff; LwpLayoutStyle* m_pStyleStuff;
LwpLayoutMisc* m_pMiscStuff; LwpLayoutMisc* m_pMiscStuff;
......
...@@ -183,12 +183,12 @@ sal_uInt32 LwpObjectID::DiskSizeIndexed() const ...@@ -183,12 +183,12 @@ sal_uInt32 LwpObjectID::DiskSizeIndexed() const
*/ */
rtl::Reference<LwpObject> LwpObjectID::obj(VO_TYPE tag) const rtl::Reference<LwpObject> LwpObjectID::obj(VO_TYPE tag) const
{ {
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); if (IsNull())
LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
if(IsNull())
{ {
return nullptr; return nullptr;
} }
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
rtl::Reference<LwpObject> pObj = pObjMgr->QueryObject(*this); rtl::Reference<LwpObject> pObj = pObjMgr->QueryObject(*this);
if( tag!=VO_INVALID && (pObj.is()) ) if( tag!=VO_INVALID && (pObj.is()) )
{ {
......
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