Kaydet (Commit) e530a7dd authored tarafından Michael Stahl's avatar Michael Stahl

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
üst 383aab7e
......@@ -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 ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment