Kaydet (Commit) 1ff36e14 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) David Tardon

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

(cherry picked from commit da5e8ba3)
Reviewed-on: https://gerrit.libreoffice.org/20531Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit 7e5b93bf)

Change-Id: I093546793755f8a3a6e8a3c23fb8565ad27b75da
Reviewed-on: https://gerrit.libreoffice.org/20532Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst da794ce0
......@@ -269,7 +269,7 @@ void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
if (!pLayoutNumerics)
{
// 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)
{
pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject().obj().get());
......@@ -656,7 +656,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
else
{
// judge base on
LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj().get());
LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
if (pBase && pBase->IsProtected())
{
bProtected = true;
......
......@@ -328,6 +328,8 @@ public:
protected:
void Read() SAL_OVERRIDE;
private:
LwpObjectID m_BasedOnStyle;
protected:
enum
{
......@@ -336,8 +338,7 @@ protected:
};
LwpObjectID m_Content;
LwpObjectID m_BasedOnStyle;
rtl::Reference<LwpObject> GetBasedOnStyle();
LwpObjectID m_TabPiece;
LwpLayoutStyle* m_pStyleStuff;
LwpLayoutMisc* m_pMiscStuff;
......
......@@ -187,12 +187,12 @@ sal_uInt32 LwpObjectID::DiskSizeIndexed() const
*/
rtl::Reference<LwpObject> LwpObjectID::obj(VO_TYPE tag) const
{
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
if(IsNull())
if (IsNull())
{
return NULL;
}
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
rtl::Reference<LwpObject> pObj = pObjMgr->QueryObject(*this);
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