From 073a90a61d35c7444e520510a5a5865584aac1ce Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 11 Feb 2018 17:10:42 +0000 Subject: ofz: Infinite-loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id745e6525728661c8ee536044f0a08c0f94445b7 Reviewed-on: https://gerrit.libreoffice.org/49564 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- lotuswordpro/source/filter/lwppara1.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lotuswordpro') 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 + // 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(GetPrevious().obj().get()); + std::set aSeen; while (pPara) { + aSeen.insert(pPara); otherlevel = pPara->GetLevel(); if ((otherlevel < level) || (otherlevel && (level == 0))) return pPara; pPara = dynamic_cast(pPara->GetPrevious().obj().get()); + if (aSeen.find(pPara) != aSeen.end()) + throw std::runtime_error("loop in conversion"); } } return nullptr; -- cgit v1.2.3