lotuswordpro/source/filter/lwptablelayout.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
New commits: commit 8f81535faf6a5d80d5e4d522768c7537e0ca5d21 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Jan 22 12:49:03 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Jan 22 15:22:53 2022 +0100 ofz#43949 Timeout Change-Id: Ia1691d30e754924314d39d733135614db4c56834 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128768 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 70a387781394..c3d027e91008 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -111,22 +111,24 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout() { LwpObjectID *pID = &GetChildTail(); - while(pID && !pID->IsNull()) + o3tl::sorted_vector<LwpObjectID*> aSeen; + while (pID && !pID->IsNull()) { + bool bAlreadySeen = !aSeen.insert(pID).second; + if (bAlreadySeen) + throw std::runtime_error("loop in conversion"); + LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pID->obj().get()); if (!pLayout) - { break; - } if (pLayout->GetLayoutType() == LWP_TABLE_LAYOUT) - { return dynamic_cast<LwpTableLayout *>(pLayout); - } pID = &pLayout->GetPrevious(); } return nullptr; } + /** * @short Get effective heading table layout, the one just before table layout is the only one which is effective * @return LwpTableHeadingLayout* - pointer to table heading layout @@ -135,23 +137,24 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout() { LwpObjectID *pID = &GetChildTail(); - while(pID && !pID->IsNull()) + o3tl::sorted_vector<LwpObjectID*> aSeen; + while (pID && !pID->IsNull()) { + bool bAlreadySeen = !aSeen.insert(pID).second; + if (bAlreadySeen) + throw std::runtime_error("loop in conversion"); + LwpLayout * pLayout = dynamic_cast<LwpLayout *>(pID->obj().get()); if (!pLayout) - { break; - } - if (pLayout->GetLayoutType() == LWP_TABLE_HEADING_LAYOUT) - { return dynamic_cast<LwpTableHeadingLayout *>(pLayout); - } pID = &pLayout->GetPrevious(); } return nullptr; } + /** * @short Register super table layout style */