Kaydet (Commit) ab665bc7 authored tarafından Caolán McNamara's avatar Caolán McNamara

guard against infinite recursion

Change-Id: I1b566c835b6cdc733d0aa4393d3b3ce2ff7b764f
(cherry picked from commit 76220aaf)
üst e95e07ef
......@@ -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)
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment