After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 654567 - xmlTextReader bails too quickly on error
xmlTextReader bails too quickly on error
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2011-07-13 17:08 UTC by Andy Lutomirski
Modified: 2012-07-18 10:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Possible fix (1.55 KB, patch)
2011-07-13 17:08 UTC, Andy Lutomirski
none Details | Review

Description Andy Lutomirski 2011-07-13 17:08:27 UTC
Created attachment 191898 [details] [review]
Possible fix

I use xmlTextReader to parse failed that might be incomplete.  These files are the beginning of a well-formed file, but the end is missing so the file as a whole is not well-formed.

The problem is that xmlTextReader starts returning errors when it encounters the early EOF, even though I haven't finished reading all of the valid data in the file.  It would be helpful if xmlTextReader kept working until the very end.

The fix might look like the attached patch.  It passes all regression tests.
Comment 1 Daniel Veillard 2012-05-15 12:12:47 UTC
I have been thinking about that one for a week or so. On one hand
the XML specification sides on the "stop reporting data as soon
as a fatal error is detected":
   http://www.w3.org/TR/REC-xml/#dt-fatal
*but* the missing end is not strictly speaking detected by the
parser itself but by the surrounding I/O feeding it in the
reader mode.
  So I think continuing to parse until the parser itself detects
the fatal error is Okay. The patch looks reasonable, I hope there
won't be nasty side effects though but I can't really think of any
at this point. So I commit this, I hope testing won't raise trouble :)

http://git.gnome.org/browse/libxml2/commit/?id=9d9685ad88c17d35b6688695af3ceba7c7309b13

  thanks !

Daniel
Comment 2 Daniel Veillard 2012-07-18 10:37:12 UTC
The problem is that the patch allowed some well formedness errors
to not be reported, i.e. a falso positive, I had to fix this and
pushed

http://git.gnome.org/browse/libxml2/commit/?id=c508fa3f0b40ba232e00ed8d514e0ba37ed602ab

as a follow up. We really can't exit xmlTextReaderPushData
knowing that the XML is not well formed without raising an
error there. Hopefully you own use case is not affected, but
accuracy there is primordial.

Daniel