diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-03-15 09:21:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-03-15 09:23:15 +0000 |
commit | 9e0004f2cc64ffa23ecd5c7c82016624eb8a5a20 (patch) | |
tree | e4b3c4ec23816282698ac009e0b5833ce6d4dd88 /lotuswordpro | |
parent | c5bee7b8c1055e5052a261c8755bdb150fb27494 (diff) |
recurse protection for XFConvert
Change-Id: Ib6008d4b07159acad26c7baeb775702119c12e3b
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp | bin | 0 -> 15952 bytes | |||
-rw-r--r-- | lotuswordpro/source/filter/lwpfootnote.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpframelayout.cxx | 4 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfribframe.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpnotes.cxx | 4 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpobj.cxx | 1 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpobj.hxx | 14 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwppagelayout.cxx | 4 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpstory.cxx | 8 |
9 files changed, 25 insertions, 14 deletions
diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp Binary files differnew file mode 100644 index 000000000000..f19b0d7f7de3 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx index 408cb48b165f..ecc5e831a290 100644 --- a/lotuswordpro/source/filter/lwpfootnote.cxx +++ b/lotuswordpro/source/filter/lwpfootnote.cxx @@ -187,7 +187,7 @@ void LwpFootnote::XFConvert(XFContentContainer * pCont) LwpContent* pContent = FindFootnoteContent(); if(pContent) { - pContent->XFConvert(pCont); + pContent->DoXFConvert(pCont); } } diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index c209cab8a69d..7f593e4a2cd7 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -835,7 +835,7 @@ void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart rtl::Reference<LwpObject> content = m_Content.obj(); if (content.is()) { - content->XFConvert(pXFFrame); + content->DoXFConvert(pXFFrame); //set frame size according to ole size ApplyGraphicSize(pXFFrame); } @@ -1103,7 +1103,7 @@ void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart while (pLayout && pLayout != this) { - pLayout->XFConvert(pXFFrame); + pLayout->DoXFConvert(pXFFrame); pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get()); } diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx index 91ee69729852..a257284b8618 100644 --- a/lotuswordpro/source/filter/lwpfribframe.cxx +++ b/lotuswordpro/source/filter/lwpfribframe.cxx @@ -180,7 +180,7 @@ void LwpFribFrame::XFConvert(XFContentContainer* pCont) } } - pLayout->XFConvert(pXFContentContainer); + pLayout->DoXFConvert(pXFContentContainer); if(m_bRevisionFlag) { diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx index 1da5922cf07e..09b28ece8b85 100644 --- a/lotuswordpro/source/filter/lwpnotes.cxx +++ b/lotuswordpro/source/filter/lwpnotes.cxx @@ -181,7 +181,7 @@ void LwpNoteLayout::XFConvert(XFContentContainer * pCont) LwpVirtualLayout* pTextLayout = GetTextLayout(); if(pTextLayout) { - pTextLayout->XFConvert(pCont); + pTextLayout->DoXFConvert(pCont); } } @@ -290,7 +290,7 @@ void LwpNoteTextLayout::XFConvert(XFContentContainer * pCont) rtl::Reference<LwpObject> pContent = m_Content.obj(); if(pContent.is()) { - pContent->XFConvert(pCont); + pContent->DoXFConvert(pCont); } } diff --git a/lotuswordpro/source/filter/lwpobj.cxx b/lotuswordpro/source/filter/lwpobj.cxx index 88397027796f..334c0c1218ff 100644 --- a/lotuswordpro/source/filter/lwpobj.cxx +++ b/lotuswordpro/source/filter/lwpobj.cxx @@ -62,6 +62,7 @@ LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm) : m_ObjHdr(objHdr), m_pObjStrm(nullptr), m_pFoundry(nullptr) , m_pStrm(pStrm), m_bRegisteringStyle(false), m_bParsingStyle(false) + , m_bConvertingContent(false) { m_pObjStrm = new LwpObjectStream(pStrm, m_ObjHdr.IsCompressed(), static_cast<sal_uInt16>(m_ObjHdr.GetSize()) ); diff --git a/lotuswordpro/source/filter/lwpobj.hxx b/lotuswordpro/source/filter/lwpobj.hxx index bcd6136ac33e..7556a4785998 100644 --- a/lotuswordpro/source/filter/lwpobj.hxx +++ b/lotuswordpro/source/filter/lwpobj.hxx @@ -92,10 +92,12 @@ protected: LwpSvStream* m_pStrm; bool m_bRegisteringStyle; bool m_bParsingStyle; + bool m_bConvertingContent; protected: virtual void Read(); virtual void RegisterStyle(); virtual void Parse(IXFStream* pOutputStream); + virtual void XFConvert(XFContentContainer* pCont); public: void QuickRead(); //calls RegisterStyle but bails if DoRegisterStyle is called @@ -118,8 +120,16 @@ public: Parse(pOutputStream); m_bParsingStyle = false; } - - virtual void XFConvert(XFContentContainer* pCont); + //calls XFConvert but bails if DoXFConvert is called + //on the same object recursively + void DoXFConvert(XFContentContainer* pCont) + { + if (m_bConvertingContent) + throw std::runtime_error("recursion in parsing"); + m_bConvertingContent = true; + XFConvert(pCont); + m_bConvertingContent = false; + } LwpFoundry* GetFoundry(){return m_pFoundry;} void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;} diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 3b10d2cb6c30..d57eadcd1030 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -889,7 +889,7 @@ void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1) RegisterChildStyle(); //End pChangeMgr->SetHeadFootChange(pHeader); - pStory->XFConvert(pHeader); + pStory->DoXFConvert(pHeader); pChangeMgr->SetHeadFootFribMap(false); } @@ -1042,7 +1042,7 @@ void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1) pChangeMgr->SetHeadFootChange(pFooter); - pStory->XFConvert(pFooter); + pStory->DoXFConvert(pFooter); pChangeMgr->SetHeadFootFribMap(false); } diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx index 6abdba41476c..09acda771d10 100644 --- a/lotuswordpro/source/filter/lwpstory.cxx +++ b/lotuswordpro/source/filter/lwpstory.cxx @@ -314,7 +314,7 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont) pCont->FindFirstContent(enumXFContentPara)); XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get()); if(pXFFirtPara) - xFrameLayout->XFConvert(pXFFirtPara); + xFrameLayout->DoXFConvert(pXFFirtPara); } xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get())); } @@ -338,7 +338,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont) || xFrameLayout->IsSuperTable() || xFrameLayout->IsGroupHead()))) { - xFrameLayout->XFConvert(pCont); + xFrameLayout->DoXFConvert(pCont); } xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get())); } @@ -358,7 +358,7 @@ void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont) { if (xFrameLayout->IsAnchorFrame()) { - xFrameLayout->XFConvert(pCont); + xFrameLayout->DoXFConvert(pCont); } xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get())); } @@ -383,7 +383,7 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont) pCont->FindFirstContent(enumXFContentPara)); XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get()); if(pXFFirtPara) - xFrameLayout->XFConvert(pXFFirtPara); + xFrameLayout->DoXFConvert(pXFFirtPara); } xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get())); } |