summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-19 14:47:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-19 21:44:37 +0100
commit3668960d94d21ad215c2cbe02f95560416b0a9e3 (patch)
tree6ab1a38ceb6eebf9861cc8b9c80132862ae99824 /lotuswordpro
parent5f0eacd721bb98a49d6066c28d4d8fddd8fda292 (diff)
ofz: infinite loop
Change-Id: Ie515421f484c63d07f10e8551464c7dc11facb73 Reviewed-on: https://gerrit.libreoffice.org/50001 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/lwprowlayout.cxx8
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx12
2 files changed, 17 insertions, 3 deletions
diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 02d9d221b304..ca1f43979e09 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -140,12 +140,18 @@ void LwpRowLayout::RegisterStyle()
LwpObjectID& rCellID= GetChildHead();
LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
- while(pCellLayout)
+ std::set<LwpCellLayout*> aSeen;
+ while (pCellLayout)
{
+ aSeen.insert(pCellLayout);
+
pCellLayout->SetFoundry(m_pFoundry);
pCellLayout->RegisterStyle();
rCellID = pCellLayout->GetNext();
pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
+
+ if (aSeen.find(pCellLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
}
}
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 78d166574959..81ee8213ff16 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -1121,14 +1121,18 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
LwpRowList* pRowList = dynamic_cast<LwpRowList*>(aRowListID.obj().get());
//loop the rowlist
- while( nullptr!=pRowList)
+ std::set<LwpRowList*> aOuterSeen;
+ while (pRowList)
{
+ aOuterSeen.insert(pRowList);
sal_uInt16 nRowID = pRowList->GetRowID();
{
LwpCellList* pCellList = dynamic_cast<LwpCellList*>(pRowList->GetChildHeadID().obj().get());
//loop the cellList
- while( nullptr!=pCellList)
+ std::set<LwpCellList*> aSeen;
+ while (pCellList)
{
+ aSeen.insert(pCellList);
{//put cell
sal_uInt16 nColID = pCellList->GetColumnID();
@@ -1146,9 +1150,13 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
}
}
pCellList = dynamic_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
+ if (aSeen.find(pCellList) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
}
}
pRowList = dynamic_cast<LwpRowList*>(pRowList->GetNextID().obj().get());
+ if (aOuterSeen.find(pRowList) != aOuterSeen.end())
+ throw std::runtime_error("loop in conversion");
}
}catch (...) {