[xml] htmlReadMemory broken if LIBXML_LEGACY_ENABLED not set



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?

Thanks,
Gary.



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