diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-08 12:43:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-08 16:12:40 +0200 |
commit | 02c9756f52565e9c13507a9a4d60d33bc18609c4 (patch) | |
tree | d47836484c3e4a4abedcb4f6de25ab93d8dbef38 /lotuswordpro | |
parent | bfcf57de81ddd5ed8544ff2ede23bd8428f0c0ce (diff) |
ofz#8161 avoid recurse to death
Change-Id: If3fc212ed0fe2b3cb3c1381198d46387861ac3dd
Reviewed-on: https://gerrit.libreoffice.org/53973
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@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 166320b0c565..4423178aeeeb 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -84,6 +84,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p , m_bGettingExtMarginsValue(false) , m_bGettingUsePrinterSettings(false) , m_bGettingScaleCenter(false) + , m_bGettingBorderStuff(false) , m_bGettingUseWhen(false) , m_bGettingStyleLayout(false) , m_nAttributes(0) @@ -788,20 +789,28 @@ double LwpMiddleLayout::ExtMarginsValue(sal_uInt8 nWhichSide) */ LwpBorderStuff* LwpMiddleLayout::GetBorderStuff() { + if (m_bGettingBorderStuff) + throw std::runtime_error("recursion in layout"); + m_bGettingBorderStuff = true; + + LwpBorderStuff* pRet = nullptr; + if(m_nOverrideFlag & OVER_BORDERS) { LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj().get()); - return pLayoutBorder ? &pLayoutBorder->GetBorderStuff() : nullptr; + pRet = pLayoutBorder ? &pLayoutBorder->GetBorderStuff() : nullptr; } else { rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get())) { - return pLay->GetBorderStuff(); + pRet = pLay->GetBorderStuff(); } } - return nullptr; + + m_bGettingBorderStuff= false; + return pRet; } /** diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index b3685f587945..2d0694b67864 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -238,6 +238,7 @@ protected: bool m_bGettingExtMarginsValue; bool m_bGettingUsePrinterSettings; bool m_bGettingScaleCenter; + bool m_bGettingBorderStuff; bool m_bGettingUseWhen; bool m_bGettingStyleLayout; sal_uInt32 m_nAttributes; |