From a9847cb1a5d231226eac58e22a4fe2705707817e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 9 Feb 2018 15:06:30 +0000 Subject: ofz: Infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9344cb70aab0fbaa194d431928eba9806d76f115 Reviewed-on: https://gerrit.libreoffice.org/49504 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- lotuswordpro/source/filter/lwptablelayout.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lotuswordpro/source') diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index f8793328cd9b..eb94eaea6758 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -82,6 +82,7 @@ #include "lwpframelayout.hxx" #include #include +#include LwpSuperTableLayout::LwpSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) : LwpPlacableLayout(objHdr, pStrm) @@ -230,8 +231,10 @@ double LwpSuperTableLayout::GetTableWidth() LwpObjectID& rColumnID = pTableLayout->GetColumnLayoutHead(); LwpColumnLayout * pColumnLayout = dynamic_cast(rColumnID.obj().get()); double dColumnWidth = dDefaultWidth; + std::set aSeen; while (pColumnLayout) { + aSeen.insert(pColumnLayout); if(pColumnLayout->GetColumnID() == i) { dColumnWidth = pColumnLayout->GetWidth(); @@ -239,6 +242,8 @@ double LwpSuperTableLayout::GetTableWidth() } rColumnID = pColumnLayout->GetNext(); pColumnLayout = dynamic_cast(rColumnID.obj().get()); + if (aSeen.find(pColumnLayout) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } dWidth += dColumnWidth; } -- cgit v1.2.3