diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-19 09:18:54 +0000 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-12-19 23:40:52 +0100 |
commit | aea7d5682ccfa886812baece60ece4ee296e8a69 (patch) | |
tree | 0c082ef9426f892333b80f5c02ad81ca2483f57e /lotuswordpro | |
parent | 423addf8bf0bbc7a2e14faffffcdddd035bc145a (diff) |
ofz#4689 avoid recurse to death
Change-Id: Ie578a767cd8646c4e67c302a67b46ce1f1637122
Reviewed-on: https://gerrit.libreoffice.org/46773
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 16 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index cb9a170159b3..7fd1060afaf2 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1948,6 +1948,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout() LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ) : LwpLayout(objHdr, pStrm) , m_bGettingWrapType(false) + , m_bGettingLayoutRelativity(false) , m_nWrapType(0) , m_nBuoyancy(0) , m_nBaseLineOffset(0) @@ -2027,11 +2028,15 @@ sal_uInt8 LwpPlacableLayout::GetWrapType() */ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() { - if(!m_LayRelativity.IsNull()) + if (m_bGettingLayoutRelativity) + throw std::runtime_error("recursion in layout"); + m_bGettingLayoutRelativity = true; + LwpLayoutRelativity* pRet = nullptr; + if (!m_LayRelativity.IsNull()) { - if(m_nOverrideFlag & OVER_PLACEMENT) + if (m_nOverrideFlag & OVER_PLACEMENT) { - return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get()); + pRet = dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get()); } } else @@ -2039,10 +2044,11 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get())) { - return pLay->GetRelativityPiece(); + pRet = pLay->GetRelativityPiece(); } } - return nullptr; + m_bGettingLayoutRelativity = false; + return pRet; } /** * @descr: Get relative type diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index 1c10f59f3feb..aba59615360b 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -497,6 +497,7 @@ protected: void Read() override; protected: bool m_bGettingWrapType; + bool m_bGettingLayoutRelativity; sal_uInt8 m_nWrapType; sal_uInt8 m_nBuoyancy; sal_Int32 m_nBaseLineOffset; |