summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-13 09:34:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-13 09:34:18 +0000
commitc5ceb92be59f805a1824f8679250564775050552 (patch)
treee5b22d0ddffe4a6258d5b4dc31a8ac29cb632929 /lotuswordpro
parentfa02fa99e0e818cf8600c63110abf1cff741e594 (diff)
infinite recurse protection
Change-Id: I7139e67e7b5bcd7e1867dff1cfbd53fa0f5748b7 (cherry picked from commit fb8cba16caa87bf21fdd2747b22d90d913557dac)
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpdoc.hxx4
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx31
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx24
3 files changed, 38 insertions, 21 deletions
diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx
index ad9d5fd6e029..17ab35d1494a 100644
--- a/lotuswordpro/source/filter/lwpdoc.hxx
+++ b/lotuswordpro/source/filter/lwpdoc.hxx
@@ -132,7 +132,7 @@ public:
void RegisterStyle() override;
inline bool IsChildDoc();
- inline bool HonorProtection();
+ inline bool GetHonorProtection();
inline LwpObjectID& GetDocData();
inline LwpObjectID& GetSocket();
@@ -176,7 +176,7 @@ inline bool LwpDocument::IsChildDoc()
{
return (m_nPersistentFlags & DOC_CHILDDOC) != 0;
}
-inline bool LwpDocument::HonorProtection()
+inline bool LwpDocument::GetHonorProtection()
{
return (m_nPersistentFlags & DOC_PROTECTED) != 0;
}
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 1bef40821ef1..86a1863f4f61 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -73,6 +73,7 @@
LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
+ , m_bGettingHonorProtection(false)
, m_nAttributes(0)
, m_nAttributes2(0)
, m_nAttributes3(0)
@@ -139,20 +140,16 @@ bool LwpVirtualLayout::HonorProtection()
return false;
LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if (pParent && !pParent->IsHeader() && pParent != this)
+ if (pParent && !pParent->IsHeader())
{
- return pParent->HonorProtection();
+ return pParent->GetHonorProtection();
}
if(m_pFoundry)//is null now
{
LwpDocument* pDoc = m_pFoundry->GetDocument();
- /*if(pDoc)
- {
- return pDoc->HonorProtection();
- }*/
if(pDoc && pDoc->GetRootDocument())
- return pDoc->GetRootDocument()->HonorProtection();
+ return pDoc->GetRootDocument()->GetHonorProtection();
}
return true;
@@ -169,7 +166,7 @@ bool LwpVirtualLayout::IsProtected()
LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
if(pParent && !pParent->IsHeader())
{
- if(pParent->HonorProtection()&&(pParent->HasProtection()||bProtected))
+ if(pParent->GetHonorProtection()&&(pParent->GetHasProtection()||bProtected))
{
return true;
}
@@ -179,7 +176,7 @@ bool LwpVirtualLayout::IsProtected()
LwpDocument* pDoc = m_pFoundry->GetDocument();
if(pDoc)
{
- if (pDoc->HonorProtection() && bProtected)
+ if (pDoc->GetHonorProtection() && bProtected)
{
return true;
}
@@ -199,9 +196,9 @@ bool LwpVirtualLayout::HasProtection()
return true;
LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if (pParent && !pParent->IsHeader() && pParent != this)
+ if (pParent && !pParent->IsHeader())
{
- return pParent->HasProtection();
+ return pParent->GetHasProtection();
}
return false;
@@ -1235,9 +1232,9 @@ bool LwpMiddleLayout::HonorProtection()
return false;
LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ if (pParent && !pParent->IsHeader())
{
- return pParent->HonorProtection();
+ return pParent->GetHonorProtection();
}
if(m_pFoundry)//is null now
@@ -1245,13 +1242,13 @@ bool LwpMiddleLayout::HonorProtection()
LwpDocument* pDoc = m_pFoundry->GetDocument();
if(pDoc)
{
- return pDoc->HonorProtection();
+ return pDoc->GetHonorProtection();
}
}
}
else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get()))
{
- return pLay->HonorProtection();
+ return pLay->GetHonorProtection();
}
return LwpVirtualLayout::HonorProtection();
@@ -1282,7 +1279,7 @@ bool LwpMiddleLayout::IsProtected()
if(pParent->IsProtected())
return true;
- if(pParent->HonorProtection())
+ if(pParent->GetHonorProtection())
return bProtected;
/* If our parent isn't honoring protection then we aren't protected. */
@@ -1294,7 +1291,7 @@ bool LwpMiddleLayout::IsProtected()
LwpDocument* pDoc = m_pFoundry->GetDocument();
if(pDoc)
{
- if (pDoc->HonorProtection())
+ if (pDoc->GetHonorProtection())
return bProtected;
/* If the document isn't honoring protection then we aren't protected.*/
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 1ed947404133..e9c039aa46dd 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -111,9 +111,25 @@ public:
bool IsAutoGrowWidth();
bool IsInlineToMargin();
virtual sal_uInt8 GetContentOrientation(){ return TEXT_ORIENT_LRTB;}
- virtual bool HonorProtection();
+ bool GetHonorProtection()
+ {
+ if (m_bGettingHonorProtection)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingHonorProtection = true;
+ bool bRet = HonorProtection();
+ m_bGettingHonorProtection = false;
+ return bRet;
+ }
virtual bool IsProtected();
- bool HasProtection();
+ bool GetHasProtection()
+ {
+ if (m_bGettingHasProtection)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingHasProtection = true;
+ bool bRet = HasProtection();
+ m_bGettingHasProtection = false;
+ return bRet;
+ }
OUString GetStyleName(){ return m_StyleName;}
bool IsComplex();
virtual bool IsAnchorPage(){ return false;}
@@ -163,7 +179,11 @@ public:
//End by
protected:
void Read() override;
+ bool HasProtection();
+ virtual bool HonorProtection();
protected:
+ bool m_bGettingHonorProtection;
+ bool m_bGettingHasProtection;
sal_uInt32 m_nAttributes;
sal_uInt32 m_nAttributes2;
sal_uInt32 m_nAttributes3;