mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
html: Fix logic in htmlAutoClose
Note that the function is never called with a NULL newtag. Fixes #591.
This commit is contained in:
17
HTMLparser.c
17
HTMLparser.c
@@ -1533,20 +1533,11 @@ htmlAutoCloseOnEnd(htmlParserCtxtPtr ctxt)
|
|||||||
static void
|
static void
|
||||||
htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag)
|
htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag)
|
||||||
{
|
{
|
||||||
while ((newtag != NULL) && (ctxt->name != NULL) &&
|
if (newtag == NULL)
|
||||||
(htmlCheckAutoClose(newtag, ctxt->name))) {
|
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
|
|
||||||
ctxt->sax->endElement(ctxt->userData, ctxt->name);
|
|
||||||
htmlnamePop(ctxt);
|
|
||||||
}
|
|
||||||
if (newtag == NULL) {
|
|
||||||
htmlAutoCloseOnEnd(ctxt);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
while ((newtag == NULL) && (ctxt->name != NULL) &&
|
while ((ctxt->name != NULL) &&
|
||||||
((xmlStrEqual(ctxt->name, BAD_CAST "head")) ||
|
(htmlCheckAutoClose(newtag, ctxt->name))) {
|
||||||
(xmlStrEqual(ctxt->name, BAD_CAST "body")) ||
|
|
||||||
(xmlStrEqual(ctxt->name, BAD_CAST "html")))) {
|
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
|
||||||
ctxt->sax->endElement(ctxt->userData, ctxt->name);
|
ctxt->sax->endElement(ctxt->userData, ctxt->name);
|
||||||
htmlnamePop(ctxt);
|
htmlnamePop(ctxt);
|
||||||
|
|||||||
Reference in New Issue
Block a user