diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-12 09:51:55 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-12-12 13:10:52 +0100 |
commit | d62d6d661c694b167b2eb303dd43839d45f69150 (patch) | |
tree | 318c314e841edc14c390601cbc9f2f145ff82666 /lotuswordpro | |
parent | 60cd9ec29d9e31506c045833ffc0bf982ef24e7f (diff) |
ofz#4600 avoid recurse to death
Change-Id: I3cdced8294b30df5936bf7e167ca8a4950dde652
Reviewed-on: https://gerrit.libreoffice.org/46285
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 | 14 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 27dbc48cc9b8..cb9a170159b3 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1947,6 +1947,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout() LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ) : LwpLayout(objHdr, pStrm) + , m_bGettingWrapType(false) , m_nWrapType(0) , m_nBuoyancy(0) , m_nBaseLineOffset(0) @@ -2002,19 +2003,24 @@ void LwpPlacableLayout::Read() */ sal_uInt8 LwpPlacableLayout::GetWrapType() { - if(m_nOverrideFlag & OVER_PLACEMENT) + if (m_bGettingWrapType) + throw std::runtime_error("recursion in layout"); + m_bGettingWrapType = true; + sal_uInt8 nWrapType = LAY_WRAP_AROUND; + if (m_nOverrideFlag & OVER_PLACEMENT) { - return m_nWrapType; + nWrapType = m_nWrapType; } else { rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get())) { - return pLay->GetWrapType(); + nWrapType = pLay->GetWrapType(); } } - return LAY_WRAP_AROUND; + m_bGettingWrapType = false; + return nWrapType; } /** * @descr: get LayoutRelativity diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index 2f23271a28a2..1c10f59f3feb 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -496,6 +496,7 @@ public: protected: void Read() override; protected: + bool m_bGettingWrapType; sal_uInt8 m_nWrapType; sal_uInt8 m_nBuoyancy; sal_Int32 m_nBaseLineOffset; |