sax/source/expatwrap/sax_expat.cxx                                |   15 
++++++----
 sw/qa/core/data/odt/fail/c2dfc5bd-8366-40e7-b862-55e13fdc52dc.odt |binary
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit aad2cdce2a2e89f35366c55878129d268cc92bef
Author: Dinh Le <infostu...@gmail.com>
Date:   Tue Sep 5 22:04:24 2017 +0200

    tdf#112164 add test document
    
    Change-Id: Iacf2bec62a8eff3c9b4e6a5971ee8e63ae00567e

diff --git a/sw/qa/core/data/odt/fail/c2dfc5bd-8366-40e7-b862-55e13fdc52dc.odt 
b/sw/qa/core/data/odt/fail/c2dfc5bd-8366-40e7-b862-55e13fdc52dc.odt
new file mode 100644
index 000000000000..7cafa8d5e19b
Binary files /dev/null and 
b/sw/qa/core/data/odt/fail/c2dfc5bd-8366-40e7-b862-55e13fdc52dc.odt differ
commit e530a7ddb1c9423487ce936e6b23b8e36449d555
Author: Michael Stahl <mst...@redhat.com>
Date:   Tue Sep 5 22:01:12 2017 +0200

    tdf#112164 sax: handle errors on last call to XML_Parse()
    
    If XML_Parse() is called with isFinal=1 and there are open tags, that is
    an error (XML_ERROR_NO_ELEMENTS) that must be converted to an exception.
    
    This reveals that we already had an incomplete input document, which
    needs to be moved to "fail" now.
    
    Change-Id: I7ce3b51bd87923b5edde621508cf38d7ebbc2b14

diff --git a/sax/source/expatwrap/sax_expat.cxx 
b/sax/source/expatwrap/sax_expat.cxx
index 96171eabf947..ef28e8340205 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -647,18 +647,23 @@ void SaxExpatParser_Impl::parse( )
     while( nRead ) {
         nRead = getEntity().converter.readAndConvert( seqOut , nBufSize );
 
+        bool bContinue(false);
+
         if( ! nRead ) {
-            XML_Parse( getEntity().pParser ,
+            // last call - must return OK
+            XML_Status const ret = XML_Parse( getEntity().pParser,
                                    reinterpret_cast<const char 
*>(seqOut.getConstArray()),
                                    0 ,
                                    1 );
-            break;
-        }
-
-        bool bContinue = ( XML_Parse( getEntity().pParser ,
+            if (ret == XML_STATUS_OK) {
+                break;
+            }
+        } else {
+            bContinue = ( XML_Parse( getEntity().pParser,
                                                 reinterpret_cast<const char 
*>(seqOut.getConstArray()),
                                                 nRead,
                                                 0 ) != XML_STATUS_ERROR );
+        }
 
         if( ! bContinue || bExceptionWasThrown ) {
 
diff --git a/sw/qa/core/data/odt/pass/tdf102018.odt 
b/sw/qa/core/data/odt/fail/tdf102018.odt
similarity index 100%
rename from sw/qa/core/data/odt/pass/tdf102018.odt
rename to sw/qa/core/data/odt/fail/tdf102018.odt
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to