lotuswordpro/source/filter/lwpdoc.cxx | 5 +++-- lotuswordpro/source/filter/lwpdoc.hxx | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
New commits: commit 76220aafe0bffe20f10b07c725cd096adb56b108 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Dec 13 17:59:02 2015 +0000 guard against infinite recursion Change-Id: I1b566c835b6cdc733d0aa4393d3b3ce2ff7b764f diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index d120d9c..9cc5f68 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -71,6 +71,7 @@ LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm) : LwpDLNFPVList(objHdr, pStrm) , m_pOwnedFoundry(nullptr) + , m_bGettingFirstDivisionWithContentsThatIsNotOLE(false) , m_nFlags(0) , m_nPersistentFlags(0) , m_pLnOpts(nullptr) @@ -619,7 +620,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() /** * @descr Get first division with contents that is not ole, copy from lwp-source code */ - LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE() + LwpDocument* LwpDocument::ImplGetFirstDivisionWithContentsThatIsNotOLE() { LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj().get()); if(pDivInfo && pDivInfo->HasContents() @@ -628,7 +629,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() LwpDocument* pDivision = GetFirstDivision(); - while (pDivision && pDivision != this) + while (pDivision) { LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE(); if(pContentDivision) diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx index 8b1bdef..5fa33f4 100644 --- a/lotuswordpro/source/filter/lwpdoc.hxx +++ b/lotuswordpro/source/filter/lwpdoc.hxx @@ -84,6 +84,7 @@ public: private: LwpFoundry* m_pOwnedFoundry; + bool m_bGettingFirstDivisionWithContentsThatIsNotOLE; //Data members in file format LwpObjectID m_DocSockID; @@ -154,7 +155,15 @@ public: LwpDocument* GetLastDivisionWithContents(); LwpDocument* GetLastInGroupWithContents(); LwpDocument* GetRootDocument(); - LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE(); + LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE() + { + if (m_bGettingFirstDivisionWithContentsThatIsNotOLE) + throw std::runtime_error("recursion in page divisions"); + m_bGettingFirstDivisionWithContentsThatIsNotOLE = true; + LwpDocument* pRet = ImplGetFirstDivisionWithContentsThatIsNotOLE(); + m_bGettingFirstDivisionWithContentsThatIsNotOLE = false; + return pRet; + } LwpDocument* GetLastDivisionThatHasEndnote(); LwpDocument* GetLastDivision(); @@ -167,6 +176,7 @@ public: private: void MaxNumberOfPages(sal_uInt16& nNumPages); + LwpDocument* ImplGetFirstDivisionWithContentsThatIsNotOLE(); void XFConvertFrameInPage(XFContentContainer* pCont); static void ChangeStyleName(); bool IsSkippedDivision();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits