mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +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
|
||||
htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag)
|
||||
{
|
||||
while ((newtag != NULL) && (ctxt->name != 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);
|
||||
if (newtag == NULL)
|
||||
return;
|
||||
}
|
||||
while ((newtag == NULL) && (ctxt->name != NULL) &&
|
||||
((xmlStrEqual(ctxt->name, BAD_CAST "head")) ||
|
||||
(xmlStrEqual(ctxt->name, BAD_CAST "body")) ||
|
||||
(xmlStrEqual(ctxt->name, BAD_CAST "html")))) {
|
||||
|
||||
while ((ctxt->name != NULL) &&
|
||||
(htmlCheckAutoClose(newtag, ctxt->name))) {
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
|
||||
ctxt->sax->endElement(ctxt->userData, ctxt->name);
|
||||
htmlnamePop(ctxt);
|
||||
|
||||
Reference in New Issue
Block a user