[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - oox/source sax/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Jul 1 03:55:17 PDT 2014


 oox/source/core/xmlfilterbase.cxx    |    6 +++++-
 sax/source/fastparser/fastparser.cxx |    3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit c14063522433306c9b7f598b623d54fefd2a443d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Jun 30 20:03:28 2014 -0400

    Use a new fast parser instance for each XML fragment.
    
    Otherwise a crash ensues when the threaded XML parsing kicks in.
    
    Change-Id: Ic41e5a29bbb860d7b63b70f2f0d8896264d9d53e
    (cherry picked from commit dc93074f71f91efd8a615ad8f1a5289deb210b75)
    Reviewed-on: https://gerrit.libreoffice.org/10003
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index cf996eb..1608aed 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -158,6 +158,7 @@ struct XmlFilterBaseImpl
 {
     typedef RefMap< OUString, Relations > RelationsMap;
 
+    Reference<XComponentContext>   mxContext;
     FastParser                     maFastParser;
     const OUString                 maBinSuffix;
     const OUString                 maVmlSuffix;
@@ -170,6 +171,7 @@ struct XmlFilterBaseImpl
 
 
 XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+    mxContext(rxContext),
     maFastParser( rxContext ),
     maBinSuffix( ".bin" ),
     maVmlSuffix( ".vml" )
@@ -268,7 +270,9 @@ OUString XmlFilterBase::getFragmentPathFromFirstTypeFromOfficeDoc( const OUStrin
 
 bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHandler )
 {
-    return importFragment(rxHandler, mxImpl->maFastParser);
+    FastParser aParser(mxImpl->mxContext);
+    registerNamespaces(aParser);
+    return importFragment(rxHandler, aParser);
 }
 
 bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHandler, FastParser& rParser )
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 4ddbd2a..e10ce3f 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1042,6 +1042,9 @@ void FastSaxParserImpl::produce( CallbackType aType )
 
 bool FastSaxParserImpl::hasNamespaceURL( const OUString& rPrefix ) const
 {
+    if (maEntities.empty())
+        return false;
+
     const Entity& rEntity = getEntity();
 
     if (rEntity.maNamespaceCount.empty())


More information about the Libreoffice-commits mailing list