diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-22 12:49:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-22 15:22:53 +0100 |
commit | 8f81535faf6a5d80d5e4d522768c7537e0ca5d21 (patch) | |
tree | bfc96a16456ced0d02a5108933c3798961942669 /lotuswordpro/source | |
parent | 8c1f919823e4386d3e2744a8b4732a5bcc1a2280 (diff) |
ofz#43949 Timeout
Change-Id: Ia1691d30e754924314d39d733135614db4c56834
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128768
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
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 */ |