summaryrefslogtreecommitdiff
path: root/lotuswordpro/source/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-09 21:32:21 +0000
committerMichael Stahl <mstahl@redhat.com>2015-12-10 15:34:05 +0000
commit17b166804c961e627dd70a04df8ae4f6bd3ae238 (patch)
treebf1406c7bf332188a2b1d19745eb93eb0e90bf23 /lotuswordpro/source/filter
parent381677690ca0f7f071cb998ec457f7b79e87c0f2 (diff)
guard against infinite recursion on registering styles
(cherry picked from commit 66686e443b568ad5aab1b32b3f25eb73487cfef6) Reviewed-on: https://gerrit.libreoffice.org/20554 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 282b1aa32c27a513eb2858ad6e7e534ef52c1b99) Change-Id: Iabedfcce9d8ef21172e6bd0d654f3a258aae97e3 Reviewed-on: https://gerrit.libreoffice.org/20556 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'lotuswordpro/source/filter')
-rw-r--r--lotuswordpro/source/filter/lwp9reader.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpdoc.cxx10
-rw-r--r--lotuswordpro/source/filter/lwpfnlayout.cxx4
-rw-r--r--lotuswordpro/source/filter/lwpfootnote.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx8
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpfribframe.cxx2
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpnotes.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpobj.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpobj.hxx15
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx5
-rw-r--r--lotuswordpro/source/filter/lwpvpointer.cxx2
14 files changed, 38 insertions, 26 deletions
diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx
index f23c8fcbd076..e74d02eb4eb4 100644
--- a/lotuswordpro/source/filter/lwp9reader.cxx
+++ b/lotuswordpro/source/filter/lwp9reader.cxx
@@ -192,7 +192,7 @@ void Lwp9Reader::ParseDocument()
//Register Styles
RegisteArrowStyles();
- doc->RegisterStyle();
+ doc->DoRegisterStyle();
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
pXFStyleManager->ToXml(m_pStream);
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 9fba0a192e35..449d28e6cfa7 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -599,7 +599,7 @@ void LwpCellLayout::RegisterStyle()
if (pObj.is())
{
pObj->SetFoundry(m_pFoundry);
- pObj->RegisterStyle();
+ pObj->DoRegisterStyle();
}
//register child layout style
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index fcbc8945aac7..c93b668af608 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -224,7 +224,7 @@ void LwpDocument::RegisterStyle()
rtl::Reference<LwpObject> pDocSock = GetSocket().obj();
if(pDocSock.is())
{
- pDocSock->RegisterStyle();
+ pDocSock->DoRegisterStyle();
}
}
/**
@@ -322,7 +322,7 @@ void LwpDocument::RegisterGraphicsStyles()
if(pGraphic.is())
{
pGraphic->SetFoundry(m_pFoundry);
- pGraphic->RegisterStyle();
+ pGraphic->DoRegisterStyle();
}
}
/**
@@ -619,7 +619,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument* pDivision = GetFirstDivision();
- while (pDivision)
+ while (pDivision && pDivision != this)
{
LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
if(pContentDivision)
@@ -782,11 +782,11 @@ void LwpDocSock::RegisterStyle()
{
rtl::Reference<LwpObject> pDoc = GetNext().obj();
if(pDoc.is())
- pDoc->RegisterStyle();
+ pDoc->DoRegisterStyle();
pDoc = GetChildHead().obj();
if(pDoc.is())
- pDoc->RegisterStyle();
+ pDoc->DoRegisterStyle();
}
/**
* @descr parse contents of documents plugged
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx
index 86ddc5fb5452..e02c59736c3d 100644
--- a/lotuswordpro/source/filter/lwpfnlayout.cxx
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -164,7 +164,7 @@ void LwpFnCellLayout::RegisterStyle()
if (pObj.is())
{
pObj->SetFoundry(m_pFoundry);
- pObj->RegisterStyle();
+ pObj->DoRegisterStyle();
}
}
@@ -241,7 +241,7 @@ void LwpEnSuperTableLayout::RegisterStyle()
if (pTableLayout != NULL)
{
pTableLayout->SetFoundry(m_pFoundry);
- pTableLayout->RegisterStyle();
+ pTableLayout->DoRegisterStyle();
}
}
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
index 5c64d00ba1a1..86c69ffd69af 100644
--- a/lotuswordpro/source/filter/lwpfootnote.cxx
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -181,7 +181,7 @@ void LwpFootnote::RegisterStyle()
if(pContent)
{
pContent->SetFoundry(m_pFoundry);
- pContent->RegisterStyle();
+ pContent->DoRegisterStyle();
}
}
}
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index d343520ae96e..3e2609fd0daa 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -202,7 +202,7 @@ void LwpFoundry::RegisterAllLayouts()
if( pStyle.is() )
{
pStyle->SetFoundry(this);
- pStyle->RegisterStyle();
+ pStyle->DoRegisterStyle();
}
//register content page layout list: Layout
@@ -210,7 +210,7 @@ void LwpFoundry::RegisterAllLayouts()
if( pStyle.is() )
{
pStyle->SetFoundry(this);
- pStyle->RegisterStyle();
+ pStyle->DoRegisterStyle();
}
//Register page style layout list: PageStyle, such as "Default Page"
@@ -218,7 +218,7 @@ void LwpFoundry::RegisterAllLayouts()
if( pStyle.is() )
{
pStyle->SetFoundry(this);
- pStyle->RegisterStyle();
+ pStyle->DoRegisterStyle();
}
//Register FrameStyle
@@ -226,7 +226,7 @@ void LwpFoundry::RegisterAllLayouts()
if( pStyle.is() )
{
pStyle->SetFoundry(this);
- pStyle->RegisterStyle();
+ pStyle->DoRegisterStyle();
}
}
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index 45cd52861f3f..47a561439faa 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -869,7 +869,7 @@ void LwpFrameLayout::RegisterStyle()
if (content.is())
{
content->SetFoundry(m_pFoundry);
- content->RegisterStyle();
+ content->DoRegisterStyle();
}
//register child frame style
diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx
index fc16cfd106a7..9f0161e83d72 100644
--- a/lotuswordpro/source/filter/lwpfribframe.cxx
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -108,7 +108,7 @@ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
if (!pLayout)
return;
pLayout->SetFoundry(pFoundry);
- pLayout->RegisterStyle();
+ pLayout->DoRegisterStyle();
//register next frib text style
sal_uInt8 nType = pLayout->GetRelativeType();
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 27f9d5c9065e..69e6b71fcf90 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -511,7 +511,7 @@ void LwpHeadLayout::RegisterStyle()
OSL_FAIL("Layout points to itself");
break;
}
- pLayout->RegisterStyle();
+ pLayout->DoRegisterStyle();
}
LwpVirtualLayout *pNext = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
if (pNext == pLayout)
diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx
index 02a4de55b9f5..dd08b1762cdc 100644
--- a/lotuswordpro/source/filter/lwpnotes.cxx
+++ b/lotuswordpro/source/filter/lwpnotes.cxx
@@ -92,7 +92,7 @@ void LwpFribNote::RegisterNewStyle()
LwpFrib::RegisterStyle(m_pPara->GetFoundry());
//register foonote style
pLayout->SetFoundry(m_pPara->GetFoundry());
- pLayout->RegisterStyle();
+ pLayout->DoRegisterStyle();
}
}
@@ -172,7 +172,7 @@ void LwpNoteLayout::RegisterStyle()
if(pTextLayout)
{
pTextLayout->SetFoundry(GetFoundry());
- pTextLayout->RegisterStyle();
+ pTextLayout->DoRegisterStyle();
}
}
@@ -284,7 +284,7 @@ void LwpNoteTextLayout::RegisterStyle()
if(pContent.is())
{
pContent->SetFoundry(GetFoundry());
- pContent->RegisterStyle();
+ pContent->DoRegisterStyle();
}
}
diff --git a/lotuswordpro/source/filter/lwpobj.cxx b/lotuswordpro/source/filter/lwpobj.cxx
index 7e15b6265fe3..010b60ebe253 100644
--- a/lotuswordpro/source/filter/lwpobj.cxx
+++ b/lotuswordpro/source/filter/lwpobj.cxx
@@ -64,7 +64,7 @@
* @descr construct lwpobject from stream
*/
LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm)
- : m_ObjHdr(objHdr), m_pObjStrm(NULL), m_pFoundry(NULL), m_pStrm(pStrm)
+ : m_ObjHdr(objHdr), m_pObjStrm(nullptr), m_pFoundry(nullptr), m_pStrm(pStrm), m_bRegisteringStyle(false)
{
m_pObjStrm = new LwpObjectStream(pStrm, m_ObjHdr.IsCompressed(),
static_cast<sal_uInt16>(m_ObjHdr.GetSize()) );
diff --git a/lotuswordpro/source/filter/lwpobj.hxx b/lotuswordpro/source/filter/lwpobj.hxx
index 942e04415dc8..23ed6b288803 100644
--- a/lotuswordpro/source/filter/lwpobj.hxx
+++ b/lotuswordpro/source/filter/lwpobj.hxx
@@ -67,6 +67,8 @@
#include <sal/config.h>
+#include <stdexcept>
+
#include <salhelper/simplereferenceobject.hxx>
#include "lwpheader.hxx"
@@ -92,11 +94,22 @@ protected:
LwpObjectStream* m_pObjStrm;
LwpFoundry* m_pFoundry;
LwpSvStream* m_pStrm;
+ bool m_bRegisteringStyle;
protected:
virtual void Read();
+ virtual void RegisterStyle();
public:
void QuickRead();
- virtual void RegisterStyle();
+ //calls RegisterStyle but bails if DoRegisterStyle is called
+ //on the same object recursively
+ void DoRegisterStyle()
+ {
+ if (m_bRegisteringStyle)
+ throw std::runtime_error("recursion in styles");
+ m_bRegisteringStyle = true;
+ RegisterStyle();
+ m_bRegisteringStyle = false;
+ }
virtual void Parse(IXFStream* pOutputStream);
virtual void XFConvert(XFContentContainer* pCont);
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 95e49d7b58c8..56048634845c 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -884,7 +884,7 @@ void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1)
//Call the RegisterStyle first to register the styles in header paras, and then XFConvert()
pStory->SetFoundry(m_pFoundry);
- pStory->RegisterStyle();
+ pStory->DoRegisterStyle();
//, 06/27/2005
//register child layout style for framelayout,
RegisterChildStyle();
@@ -1037,8 +1037,7 @@ void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1)
pChangeMgr->SetHeadFootFribMap(true);
pStory->SetFoundry(m_pFoundry);
- pStory->RegisterStyle();
- //, 06/27/2005
+ pStory->DoRegisterStyle();
//register child layout style for framelayout,
RegisterChildStyle();
//End
diff --git a/lotuswordpro/source/filter/lwpvpointer.cxx b/lotuswordpro/source/filter/lwpvpointer.cxx
index 796e0d4b4b2a..9d1a7dcd047e 100644
--- a/lotuswordpro/source/filter/lwpvpointer.cxx
+++ b/lotuswordpro/source/filter/lwpvpointer.cxx
@@ -77,7 +77,7 @@ void LwpVersionedPointer::RegisterStyle()
if( pObj.is() )
{
pObj->SetFoundry(m_pFoundry);
- pObj->RegisterStyle();
+ pObj->DoRegisterStyle();
}
}