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 564217 - Sax structured error handler incorrectly overriden
Sax structured error handler incorrectly overriden
Product: libxml2
Classification: Platform
Component: general
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Reported: 2008-12-12 09:37 UTC by cfis
Modified: 2009-08-21 22:08 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description cfis 2008-12-12 09:37:24 UTC
Please describe the problem:
If you install a global structure error handler, it incorrectly overrides a sax specific error handler.

If you follow the instructions to reproduce you'll see:

xmlParseElement -> xmlFatalErrMsgStrIntStr -> xmlRaiseError

xmlFatalErrMsgStrIntStr passes NULL for the channel and schannel.  xmlRaiseError then correctly sets the schannel around line 461 in error.c:

	if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
	    (ctxt->sax->initialized == XML_SAX2_MAGIC))
	    schannel = ctxt->sax->serror;

But then around line 606:

    } else if (channel == NULL) {
        if (xmlStructuredError != NULL)
	    schannel = xmlStructuredError;

This code is incorrect in my view.  It should be:

    } else if (channel == NULL) {
        if (schannel == NULL && xmlStructuredError != NULL)
	    schannel = xmlStructuredError;



Steps to reproduce:
1. Setup a sax parser with a structured error handler
2. Install a global structured error handler
3. Parse an invalid document (for example, <Foo>)
4.  The global handler is called, not the sax one

Actual results:

Expected results:

Does this happen every time?

Other information:
Comment 1 Daniel Veillard 2009-04-02 12:03:33 UTC
Okay, makes sense, but next time if you have a patch attach it
to the bug and flag it as such, this help against patches lost
in the large set of issues.

  Applied and commited, thanks,

Comment 2 tao 2009-07-01 13:24:46 UTC
@Daniel: you mention that you've applied and committed this patch; any estimate on when the next version (2.7.4?) of libxml2 will be released?
Comment 3 Daniel Veillard 2009-08-21 22:08:06 UTC
within a few days, probably early next week