From 1404b82e8d4fb9c809cfe478807d3831b2c924a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 19 Feb 2018 14:40:15 +0000 Subject: [PATCH] ofz: infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2230a3fdd602063e66f56d23c15f79d6d4de4c8a Reviewed-on: https://gerrit.libreoffice.org/50000 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- lotuswordpro/source/filter/lwptablelayout.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 81ee8213ff16..33a7b412efa7 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -451,8 +451,11 @@ void LwpTableLayout::TraverseTable() // set value LwpObjectID& rRowID = GetChildHead(); LwpRowLayout * pRowLayout = dynamic_cast(rRowID.obj().get()); + std::set aSeen; while (pRowLayout) { + aSeen.insert(pRowLayout); + pRowLayout->SetRowMap(); // for 's analysis job @@ -462,6 +465,8 @@ void LwpTableLayout::TraverseTable() rRowID = pRowLayout->GetNext(); pRowLayout = dynamic_cast(rRowID.obj().get()); + if (aSeen.find(pRowLayout) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } } @@ -563,8 +568,11 @@ void LwpTableLayout::RegisterColumns() // NOTICE: all default columns are regarded as justifiable columns LwpObjectID& rColumnID = GetColumnLayoutHead(); LwpColumnLayout * pColumnLayout = dynamic_cast(rColumnID.obj().get()); + std::set aSeen; while (pColumnLayout) { + aSeen.insert(pColumnLayout); + auto nColId = pColumnLayout->GetColumnID(); if (nColId >= nCols) { @@ -580,6 +588,9 @@ void LwpTableLayout::RegisterColumns() rColumnID = pColumnLayout->GetNext(); pColumnLayout = dynamic_cast(rColumnID.obj().get()); + + if (aSeen.find(pColumnLayout) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } // if all columns are not justifiable, the rightmost column will be changed to justifiable