summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-25 14:01:25 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-04-10 10:49:52 +0200
commitd7608726fbdc42749c35a3a49d094cd0c5c3476d (patch)
tree322d7ade93458a60df03ebbb1c318e3412f24e13
parent9d3444ffe5b0ec37ad99d6969179184abea21385 (diff)
ofz#7109 infinite regress
Change-Id: Iac0bd81c9b0e3ac6b005bb0065895ca1b4ca4233 Reviewed-on: https://gerrit.libreoffice.org/51827 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-4.lwpbin0 -> 15012 bytes
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx5
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx14
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx4
4 files changed, 17 insertions, 6 deletions
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
new file mode 100644
index 000000000000..f48c5bb718a4
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
Binary files differ
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 7fd1060afaf2..7a1dddda5954 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -79,6 +79,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
, m_bGettingMarginsSameAsParent(false)
, m_bGettingHasProtection(false)
, m_bGettingIsProtected(false)
+ , m_bGettingIsAutoGrowDown(false)
, m_bGettingMarginsValue(false)
, m_bGettingExtMarginsValue(false)
, m_bGettingUsePrinterSettings(false)
@@ -399,7 +400,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
*/
bool LwpVirtualLayout::IsFitGraphic()
{
- return IsAutoGrowRight() && !IsAutoGrowLeft() && IsAutoGrowDown();
+ return IsAutoGrowRight() && !IsAutoGrowLeft() && GetIsAutoGrowDown();
}
/**
@@ -1164,7 +1165,7 @@ bool LwpMiddleLayout::IsAutoGrowDown()
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
{
- return pLay->IsAutoGrowDown();
+ return pLay->GetIsAutoGrowDown();
}
}
return LwpVirtualLayout::IsAutoGrowDown();
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index aba59615360b..560822c858c6 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -103,7 +103,6 @@ public:
virtual double GetColGap(sal_uInt16 nIndex);
virtual bool IsAutoGrow(){ return false;}
virtual bool IsAutoGrowUp(){ return false;}
- virtual bool IsAutoGrowDown(){ return false;}
virtual bool IsAutoGrowLeft(){ return false;}
virtual bool IsAutoGrowRight(){ return false;}
bool IsFitGraphic();
@@ -137,6 +136,15 @@ public:
m_bGettingIsProtected = false;
return bRet;
}
+ bool GetIsAutoGrowDown()
+ {
+ if (m_bGettingIsAutoGrowDown)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingIsAutoGrowDown = true;
+ bool bRet = IsAutoGrowDown();
+ m_bGettingIsAutoGrowDown = false;
+ return bRet;
+ }
bool GetHasProtection()
{
if (m_bGettingHasProtection)
@@ -216,6 +224,7 @@ protected:
bool HasProtection();
virtual bool HonorProtection();
virtual bool IsProtected();
+ virtual bool IsAutoGrowDown(){ return false;}
virtual double MarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
virtual double ExtMarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
virtual bool MarginsSameAsParent();
@@ -224,6 +233,7 @@ protected:
bool m_bGettingMarginsSameAsParent;
bool m_bGettingHasProtection;
bool m_bGettingIsProtected;
+ bool m_bGettingIsAutoGrowDown;
bool m_bGettingMarginsValue;
bool m_bGettingExtMarginsValue;
bool m_bGettingUsePrinterSettings;
@@ -351,7 +361,6 @@ public:
LwpColor* GetBackColor();
virtual bool IsAutoGrow() override;
virtual bool IsAutoGrowUp() override;
- virtual bool IsAutoGrowDown() override;
virtual bool IsAutoGrowLeft() override;
virtual bool IsAutoGrowRight() override;
virtual sal_uInt8 GetContentOrientation() override;
@@ -389,6 +398,7 @@ protected:
virtual bool MarginsSameAsParent() override;
virtual double MarginsValue(sal_uInt8 nWhichSide) override;
virtual double ExtMarginsValue(sal_uInt8 nWhichSide) override;
+ virtual bool IsAutoGrowDown() override;
private:
LwpObjectID m_BasedOnStyle;
LwpLayoutGeometry* Geometry();
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index fc5d77ab90de..cb78e32d5136 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -467,7 +467,7 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
//get fillerpage story from division info
LwpDocument* pDoc = m_pFoundry->GetDocument();
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
- LwpStory* pStory = dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get());
+ LwpStory* pStory = pDivInfo ? dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get()) : nullptr;
//parse fillerpage story
if(pStory)
@@ -772,7 +772,7 @@ void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1)
{
//Set height: from top of header to top of body, including the spacing between header and body
double height = GetGeometryHeight()- GetMarginsValue(MARGIN_TOP);
- if( IsAutoGrowDown() )
+ if (GetIsAutoGrowDown())
{
ph1->SetMinHeight(height);
}