sax/source/fastparser/fastparser.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 313b2c4973a367c3c2ac3e0677e5166f4d6a2e85
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Mon Jun 30 14:01:16 2014 -0400

    Check for empty() before calling top().
    
    Else it might crash sometimes.
    
    Change-Id: I6a24fff83c3d36346debae5c0f2b8c0646a15c01
    (cherry picked from commit 3f177756dbdb67d901453000c3f11694770d2761)

diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index aa75513..4ddbd2a 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -688,6 +688,9 @@ sal_Int32 FastSaxParserImpl::GetTokenWithPrefix( const 
sal_Char*pPrefix, int nPr
     sal_Int32 nNamespaceToken = FastToken::DONTKNOW;
 
     Entity& rEntity = getEntity();
+    if (rEntity.maNamespaceCount.empty())
+        return nNamespaceToken;
+
     sal_uInt32 nNamespace = rEntity.maNamespaceCount.top();
     while( nNamespace-- )
     {
commit b8255bc0ac513af5d9bc7ae026caf885f71569c6
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Mon Jun 30 13:43:55 2014 -0400

    Don't go further and pop the stack if it's empty.
    
    Change-Id: I27bd30ca65cf0066cd022b4b060757913ea01fed
    (cherry picked from commit 3ede68e1cc879e6adbf6336eccaf88ced974b8b6)

diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index 0cfdb14..aa75513 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -492,6 +492,12 @@ void Entity::characters( const OUString& sChars )
 
 void Entity::endElement()
 {
+    if (maContextStack.empty())
+    {
+        // Malformed XML stream !?
+        return;
+    }
+
     const SaxContext& aContext = maContextStack.top();
     const Reference< XFastContextHandler >& xContext( aContext.mxContext );
     if( xContext.is() ) try
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to