summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-08 10:01:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-08 10:01:49 +0000
commitf9826620aae0f9f9fb1dd30216e6be317ecb103b (patch)
tree05d3a1d60fede7be55e174855d20ed5ef06542ba /lotuswordpro
parent7c406640970c7b881946f454e20293d43e3b65e0 (diff)
ofz#6104 guard against self recursive GetShadow
Change-Id: If1cf0ef365f78665cc5b9f5f1ea53e82b531f9b0
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx19
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx2
2 files changed, 15 insertions, 6 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index c3aae4ee1369..5dc583dce675 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1422,9 +1422,11 @@ bool LwpMiddleLayout::HasContent()
return content.is();
}
-LwpLayout::LwpLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ) :
- LwpMiddleLayout(objHdr, pStrm)
-{}
+LwpLayout::LwpLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
+ : LwpMiddleLayout(objHdr, pStrm)
+ , m_bGettingShadow(false)
+{
+}
LwpLayout::~LwpLayout()
{
@@ -1813,20 +1815,25 @@ bool LwpLayout::IsUseOnPage()
*/
LwpShadow* LwpLayout::GetShadow()
{
+ if (m_bGettingShadow)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingShadow = true;
+ LwpShadow* pRet = nullptr;
if(m_nOverrideFlag & OVER_SHADOW)
{
LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj().get());
- return pLayoutShadow ? &pLayoutShadow->GetShadow() : nullptr;
+ pRet = pLayoutShadow ? &pLayoutShadow->GetShadow() : nullptr;
}
else
{
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
{
- return pLay->GetShadow();
+ pRet = pLay->GetShadow();
}
}
- return nullptr;
+ m_bGettingShadow = false;
+ return pRet;
}
/**
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 3c900b4d8a6d..a0f6ef868da3 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -415,6 +415,8 @@ public:
class LwpLayout : public LwpMiddleLayout
{
+private:
+ bool m_bGettingShadow;
public:
LwpLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm );
virtual ~LwpLayout() override;