diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-12 09:51:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-12 17:24:14 +0100 |
commit | 866898afa9ccff04443473089896cda793a90d47 (patch) | |
tree | 980f3627f01716d65cacd9bf6144da688c766c3d /lotuswordpro | |
parent | e650a23b203494cc005f689129e95801acb888a1 (diff) |
ofz#4600 avoid recurse to death
Change-Id: I3cdced8294b30df5936bf7e167ca8a4950dde652
Reviewed-on: https://gerrit.libreoffice.org/46284
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 | 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 30ec9d0a4805..b746a2d94c1e 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1915,6 +1915,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) @@ -1970,19 +1971,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 cd84af5b380b..387d68488fd5 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -493,6 +493,7 @@ public: protected: void Read() override; protected: + bool m_bGettingWrapType; sal_uInt8 m_nWrapType; sal_uInt8 m_nBuoyancy; sal_Int32 m_nBaseLineOffset; |