lotuswordpro/source/filter/lwpdoc.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
New commits: commit 8d1de00d3efb0f772b1c64c315bd337601b14d91 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Mar 29 09:11:33 2018 +0100 lwp infinite loop Change-Id: Ic384dfd66f834ee360c60e497b8b7b688c913f02 Reviewed-on: https://gerrit.libreoffice.org/52057 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index 728df2e413b8..77dae05e68dc 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -628,14 +628,15 @@ LwpDocument* LwpDocument::GetLastDivisionWithContents() LwpDocument* LwpDocument::GetRootDocument() { LwpDocument* pRoot = this; - while(pRoot) + std::set<LwpDocument*> aSeen; + while (pRoot) { + aSeen.insert(pRoot); if(!pRoot->IsChildDoc()) return pRoot; - LwpDocument* pNextRoot = pRoot->GetParentDivision(); - if (pNextRoot == pRoot) - throw std::runtime_error("loop in ParentDivision"); - pRoot = pNextRoot; + pRoot = pRoot->GetParentDivision(); + if (aSeen.find(pRoot) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } return nullptr; } @@ -670,12 +671,12 @@ LwpDocument* LwpDocument::GetLastDivisionWithContents() std::set<LwpDocument*> aSeen; while (pLastDoc) { - if (aSeen.find(pLastDoc) != aSeen.end()) - throw std::runtime_error("loop in conversion"); + aSeen.insert(pLastDoc); if (pLastDoc->GetEnSuperTableLayout().is()) return pLastDoc; pLastDoc = pLastDoc->GetPreviousDivisionWithContents(); - aSeen.insert(pLastDoc); + if (aSeen.find(pLastDoc) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } return nullptr; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits