diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-07 08:56:44 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-12-08 16:44:11 +0100 |
commit | 1de1c5ebb450a82b24bf754764a9da041d351c2d (patch) | |
tree | 5e53a04d25a814efce126bbb370f0e5c20a3f372 /lotuswordpro | |
parent | 534fd9aacd3eea10070a3ee88fc654eb9791aa24 (diff) |
ofz#4548 infinite regress in GetUsePrinterSettings
Change-Id: Id4505f9a4ddc47f2eb45cb86d46fdd050b007c26
Reviewed-on: https://gerrit.libreoffice.org/46025
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 15 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index c241e84f1898..6072a6955ab5 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -81,6 +81,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm) , m_bGettingIsProtected(false) , m_bGettingMarginsValue(false) , m_bGettingExtMarginsValue(false) + , m_bGettingUsePrinterSettings(false) , m_nAttributes(0) , m_nAttributes2(0) , m_nAttributes3(0) @@ -1431,19 +1432,27 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage() */ bool LwpMiddleLayout::GetUsePrinterSettings() { + if (m_bGettingUsePrinterSettings) + throw std::runtime_error("recursion in layout"); + m_bGettingUsePrinterSettings = true; + + bool bRet = false; + if(m_nOverrideFlag & OVER_SIZE) { - return (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0; + bRet = (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0; } else { rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get())) { - return pLay->GetUsePrinterSettings(); + bRet = pLay->GetUsePrinterSettings(); } } - return false; + + m_bGettingUsePrinterSettings = false; + return bRet; } //Check whether there are contents in the layout diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index bfd9dc097aa3..1a66d4e66c72 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -226,6 +226,7 @@ protected: bool m_bGettingIsProtected; bool m_bGettingMarginsValue; bool m_bGettingExtMarginsValue; + bool m_bGettingUsePrinterSettings; sal_uInt32 m_nAttributes; sal_uInt32 m_nAttributes2; sal_uInt32 m_nAttributes3; |