From 78a43ceeca45f42d674bbf8b5c95a108ebc6590c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 26 Mar 2018 17:02:46 +0100 Subject: ofz#7146 Infinite recurse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0afc3a73933e3370c5b1aeca1beabec94c56a6e6 Reviewed-on: https://gerrit.libreoffice.org/51911 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- lotuswordpro/source/filter/lwplayout.cxx | 21 ++++++++++++++++----- lotuswordpro/source/filter/lwplayout.hxx | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 7931f7b0dee4..166320b0c565 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -83,6 +83,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p , m_bGettingMarginsValue(false) , m_bGettingExtMarginsValue(false) , m_bGettingUsePrinterSettings(false) + , m_bGettingScaleCenter(false) , m_bGettingUseWhen(false) , m_bGettingStyleLayout(false) , m_nAttributes(0) @@ -953,16 +954,26 @@ sal_uInt16 LwpMiddleLayout::GetScaleTile() sal_uInt16 LwpMiddleLayout::GetScaleCenter() { + if (m_bGettingScaleCenter) + throw std::runtime_error("recursion in layout"); + m_bGettingScaleCenter = true; + + sal_uInt16 nRet = 0; + if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale()) { - return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED) + nRet = (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED) ? 1 : 0; } - rtl::Reference xBase(GetBasedOnStyle()); - if (xBase.is()) - return dynamic_cast(*xBase.get()).GetScaleCenter(); else - return 0; + { + rtl::Reference xBase(GetBasedOnStyle()); + if (xBase.is()) + nRet = dynamic_cast(*xBase.get()).GetScaleCenter(); + } + + m_bGettingScaleCenter = false; + return nRet; } bool LwpMiddleLayout::CanSizeRight() diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index a1e9db694e29..b3685f587945 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -237,6 +237,7 @@ protected: bool m_bGettingMarginsValue; bool m_bGettingExtMarginsValue; bool m_bGettingUsePrinterSettings; + bool m_bGettingScaleCenter; bool m_bGettingUseWhen; bool m_bGettingStyleLayout; sal_uInt32 m_nAttributes; -- cgit