diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-11 17:10:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-11 22:08:57 +0100 |
commit | 073a90a61d35c7444e520510a5a5865584aac1ce (patch) | |
tree | a4a26f85164c568717e5e1b5d1a42cfda585dac0 /lotuswordpro | |
parent | b083916a51f267e728c24f827263387c4c52df3a (diff) |
ofz: Infinite-loop
Change-Id: Id745e6525728661c8ee536044f0a08c0f94445b7
Reviewed-on: https://gerrit.libreoffice.org/49564
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/lwppara1.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx index 21b341df589a..14c1e7244f14 100644 --- a/lotuswordpro/source/filter/lwppara1.cxx +++ b/lotuswordpro/source/filter/lwppara1.cxx @@ -102,6 +102,8 @@ #include "lwpcelllayout.hxx" #include "lwpframelayout.hxx" +#include <set> + // boost::polymorphic_downcast checks and reports (using assert), if the // cast is incorrect (in debug builds). using boost::polymorphic_downcast; @@ -166,12 +168,16 @@ LwpPara* LwpPara::GetParent() if (level != 1) { pPara = dynamic_cast<LwpPara*>(GetPrevious().obj().get()); + std::set<LwpPara*> aSeen; while (pPara) { + aSeen.insert(pPara); otherlevel = pPara->GetLevel(); if ((otherlevel < level) || (otherlevel && (level == 0))) return pPara; pPara = dynamic_cast<LwpPara*>(pPara->GetPrevious().obj().get()); + if (aSeen.find(pPara) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } } return nullptr; |