Re: [xml] htmlReadMemory broken if LIBXML_LEGACY_ENABLED not set



On Wed, Nov 16, 2005 at 03:30:33PM +0000, Gary Coady wrote:
Hi there,
while tracking down an apparent regression in HTML parsing, I found that
the checkin for bug 306901 breaks htmlReadMemory, when used in a
multithreaded app. The change was to call
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
only if both LIBXML_HTML_ENABLED AND LIBXML_LEGACY_ENABLED were set.

The problem (from the PoV of htmlReadMemory) occurs at line 5936 of
HTMLparser.c:
if (ctxt->sax != NULL)
    memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1));

At this point ctxt->sax is usually (but not always, based on the checkin
which added those lines) initialized correctly before this point, and is
then reset to a large set of NULL pointers, since the default SAX
handler is not set in the per-thread data.

I'm setting LIBXML_LEGACY_ENABLED to get around this - but I was
wondering if the HTML parsing is supposed to require LIBXML_LEGACY_ENABLED?

  I'm unclear about this, please bugzilla so it's not dropped, just make a
reference to the old bug. Also if you are multithreaded, then you must call
the library initialization call at startup, then I think the default sax
handler should be initialized.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]