diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-18 21:06:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-19 00:28:36 +0100 |
commit | 68cebacac864da199ace7fe03db0e054e6b36966 (patch) | |
tree | 6240f0929289d11bf72518557086676b807306c3 /lotuswordpro | |
parent | 4c15c1334406eb36e961e9fb7e782d26a830d958 (diff) |
ofz#6448 infinite-regress
Change-Id: Ie0c082a4b43355e935594f2dda694edfc9cdf315
Reviewed-on: https://gerrit.libreoffice.org/49950
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 | 29 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 1 |
2 files changed, 16 insertions, 14 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index b18896468f22..df43d93a81e2 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1424,6 +1424,7 @@ bool LwpMiddleLayout::HasContent() LwpLayout::LwpLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) : LwpMiddleLayout(objHdr, pStrm) , m_bGettingShadow(false) + , m_bGettingNumCols(false) { } @@ -1472,24 +1473,24 @@ void LwpLayout::Read() */ sal_uInt16 LwpLayout::GetNumCols() { - if(m_nOverrideFlag & OVER_COLUMNS) + if (m_bGettingNumCols) + throw std::runtime_error("recursion in layout"); + m_bGettingNumCols = true; + + sal_uInt16 nRet = 0; + LwpLayoutColumns* pLayColumns = (m_nOverrideFlag & OVER_COLUMNS) ? dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get()) : nullptr; + if (pLayColumns) { - LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get()); - if(pLayColumns) - { - return pLayColumns->GetNumCols(); - } + nRet = pLayColumns->GetNumCols(); } - - rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); - LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get()); - if (pStyle) + else { - return pStyle->GetNumCols(); + rtl::Reference<LwpObject> xBase(GetBasedOnStyle()); + LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get()); + nRet = pStyle ? pStyle->GetNumCols() : LwpVirtualLayout::GetNumCols(); } - - return LwpVirtualLayout::GetNumCols(); - + m_bGettingNumCols = false; + return nRet; } /** diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index a0f6ef868da3..50dbcdf57197 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -417,6 +417,7 @@ class LwpLayout : public LwpMiddleLayout { private: bool m_bGettingShadow; + bool m_bGettingNumCols; public: LwpLayout( LwpObjectHeader const &objHdr, LwpSvStream* pStrm ); virtual ~LwpLayout() override; |