[Libreoffice-commits] core.git: lotuswordpro/qa lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Tue Mar 8 12:10:39 UTC 2016


 lotuswordpro/qa/cppunit/data/fail/loop-2.lwp              |binary
 lotuswordpro/source/filter/xfilter/xfcontent.hxx          |   20 +++++++++++---
 lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx |    2 -
 lotuswordpro/source/filter/xfilter/xftextspan.cxx         |    6 ++--
 4 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit f16ceae46dd8f3974a379c6fb07feaffb8012b25
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 8 12:09:55 2016 +0000

    avoid infinite regress in busted documents
    
    Change-Id: I639617e41cd9a9a51a3dd3efa32ac1cf2991b9d2

diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp
new file mode 100644
index 0000000..6342cc5
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp differ
diff --git a/lotuswordpro/source/filter/xfilter/xfcontent.hxx b/lotuswordpro/source/filter/xfilter/xfcontent.hxx
index 2d1dfa7..8537905 100644
--- a/lotuswordpro/source/filter/xfilter/xfcontent.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfcontent.hxx
@@ -92,14 +92,28 @@ public:
      */
     OUString   GetStyleName() {return m_strStyleName;}
 
-    virtual void ToXml(IXFStream * stream) = 0;
+    void DoToXml(IXFStream* stream)
+    {
+        if (m_bDoingToXml)
+            throw std::runtime_error("recursion in content");
+        m_bDoingToXml = true;
+        ToXml(stream);
+        m_bDoingToXml = false;
+    }
 
 protected:
-    XFContent() {}
+    XFContent()
+        : m_bDoingToXml(false)
+    {
+    }
+
+    virtual void ToXml(IXFStream* stream) = 0;
 
     virtual ~XFContent() {}
 
-    OUString   m_strStyleName;
+    OUString m_strStyleName;
+private:
+    bool m_bDoingToXml;
 };
 
 #endif
diff --git a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
index 05a24f9..7608da2 100644
--- a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
@@ -131,7 +131,7 @@ void    XFContentContainer::ToXml(IXFStream *pStrm)
     {
         XFContent *pContent = it->get();
         if( pContent )
-            pContent->ToXml(pStrm);
+            pContent->DoToXml(pStrm);
     }
 }
 
diff --git a/lotuswordpro/source/filter/xfilter/xftextspan.cxx b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
index 4de6bad..90f6e32 100644
--- a/lotuswordpro/source/filter/xfilter/xftextspan.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
@@ -112,7 +112,7 @@ void    XFTextSpan::ToXml(IXFStream *pStrm)
     {
         XFContent *pContent = it->get();
         if( pContent )
-            pContent->ToXml(pStrm);
+            pContent->DoToXml(pStrm);
     }
 
     pStrm->EndElement( "text:span" );
@@ -135,7 +135,7 @@ void    XFTextSpanStart::ToXml(IXFStream *pStrm)
     {
         XFContent *pContent = it->get();
         if( pContent )
-            pContent->ToXml(pStrm);
+            pContent->DoToXml(pStrm);
     }
 }
 void    XFTextSpanEnd::ToXml(IXFStream *pStrm)
@@ -145,7 +145,7 @@ void    XFTextSpanEnd::ToXml(IXFStream *pStrm)
     {
         XFContent *pContent = it->get();
         if( pContent )
-            pContent->ToXml(pStrm);
+            pContent->DoToXml(pStrm);
     }
     pStrm->EndElement( "text:span" );
 }


More information about the Libreoffice-commits mailing list