diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-28 10:46:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-28 14:54:53 +0100 |
commit | 018bf569904e77e897b9b76f17a9b539cc415dcc (patch) | |
tree | f920fd872a0fe06dd48a7b58b1047156c10ffc58 /lotuswordpro | |
parent | 2065cbf576e7d3257e7da2151419404928326df3 (diff) |
ofz#20361 infinite recursion
Change-Id: I2434df7a08ddbc557879404504d3adc30e04d683
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87599
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 21 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 1 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index d9b442268b04..9d8b33fa94b5 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -88,6 +88,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p , m_bGettingBorderStuff(false) , m_bGettingUseWhen(false) , m_bGettingStyleLayout(false) + , m_bGettingAutoGrowUp(false) , m_nAttributes(0) , m_nAttributes2(0) , m_nAttributes3(0) @@ -1189,19 +1190,27 @@ bool LwpMiddleLayout::IsAutoGrowDown() */ bool LwpMiddleLayout::IsAutoGrowUp() { - if(m_nOverrideFlag & OVER_SIZE) + if (m_bGettingAutoGrowUp) + throw std::runtime_error("recursion in layout"); + m_bGettingAutoGrowUp = true; + + bool bRet; + + if (m_nOverrideFlag & OVER_SIZE) { - return (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0; + bRet = (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0; } else { rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get())) - { - return pLay->IsAutoGrowUp(); - } + bRet = pLay->IsAutoGrowUp(); + else + bRet = LwpVirtualLayout::IsAutoGrowUp(); } - return LwpVirtualLayout::IsAutoGrowUp(); + + m_bGettingAutoGrowUp = false; + return bRet; } /** diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index c68a82d1edd3..c11f830c83a5 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -240,6 +240,7 @@ protected: bool m_bGettingBorderStuff; bool m_bGettingUseWhen; bool m_bGettingStyleLayout; + bool m_bGettingAutoGrowUp; sal_uInt32 m_nAttributes; sal_uInt32 m_nAttributes2; sal_uInt32 m_nAttributes3; |