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

Caolán McNamara caolanm at redhat.com
Tue Dec 2 09:11:33 PST 2014


 sax/source/fastparser/fastparser.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 060317b22fe5d09d1a45541ca5b5c5db46a83f29
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 2 11:36:53 2014 +0000

    fix crash-190212-093017-986
    
    Change-Id: I3d2d57850dcb1fde1c004b4455591071a1fe03fa
    (cherry picked from commit 4a757923fed5210d7bcf580865d53d4097dfbc8e)

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 0de4f42..83bd7da 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -463,6 +463,12 @@ void Entity::startElement( Event *pEvent )
 
 void Entity::characters( const OUString& sChars )
 {
+    if (maContextStack.empty())
+    {
+        // Malformed XML stream !?
+        return;
+    }
+
     const Reference< XFastContextHandler >& xContext( maContextStack.top().mxContext );
     if( xContext.is() ) try
     {
@@ -1138,11 +1144,11 @@ void FastSaxParserImpl::callbackEndElement( const xmlChar*, const xmlChar*, cons
     if( !pendingCharacters.isEmpty())
         sendPendingCharacters();
     Entity& rEntity = getEntity();
-    assert( !rEntity.maNamespaceCount.empty() );
+    SAL_WARN_IF(rEntity.maNamespaceCount.empty(), "sax", "Empty NamespaceCount");
     if( !rEntity.maNamespaceCount.empty() )
         rEntity.maNamespaceCount.pop();
 
-    assert( !rEntity.maNamespaceStack.empty() );
+    SAL_WARN_IF(rEntity.maNamespaceStack.empty(), "sax", "Empty NamespaceStack");
     if( !rEntity.maNamespaceStack.empty() )
         rEntity.maNamespaceStack.pop();
 


More information about the Libreoffice-commits mailing list