mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
html: Fix parsing of end tags
This commit is contained in:
18
HTMLparser.c
18
HTMLparser.c
@ -3877,6 +3877,11 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
|||||||
}
|
}
|
||||||
SKIP(2);
|
SKIP(2);
|
||||||
|
|
||||||
|
if (CUR == '>') {
|
||||||
|
SKIP(1);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!IS_ASCII_LETTER(CUR)) {
|
if (!IS_ASCII_LETTER(CUR)) {
|
||||||
htmlParseComment(ctxt, /* bogus */ 1);
|
htmlParseComment(ctxt, /* bogus */ 1);
|
||||||
return(0);
|
return(0);
|
||||||
@ -3890,7 +3895,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
|||||||
* Parse and ignore attributes.
|
* Parse and ignore attributes.
|
||||||
*/
|
*/
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
while ((CUR != 0) &&
|
while ((ctxt->input->cur < ctxt->input->end) &&
|
||||||
(CUR != '>') &&
|
(CUR != '>') &&
|
||||||
((CUR != '/') || (NXT(1) != '>')) &&
|
((CUR != '/') || (NXT(1) != '>')) &&
|
||||||
(ctxt->instate != XML_PARSER_EOF)) {
|
(ctxt->instate != XML_PARSER_EOF)) {
|
||||||
@ -3915,8 +3920,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
|
|||||||
} else if ((CUR == '/') && (NXT(1) == '>')) {
|
} else if ((CUR == '/') && (NXT(1) == '>')) {
|
||||||
SKIP(2);
|
SKIP(2);
|
||||||
} else {
|
} else {
|
||||||
htmlParseErr(ctxt, XML_ERR_GT_REQUIRED,
|
return(0);
|
||||||
"End tag : expected '>'\n", NULL, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctxt->options & HTML_PARSE_HTML5) {
|
if (ctxt->options & HTML_PARSE_HTML5) {
|
||||||
@ -5192,8 +5196,14 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XML_PARSER_END_TAG:
|
case XML_PARSER_END_TAG:
|
||||||
if (avail < 2)
|
if ((terminate) && (avail == 2)) {
|
||||||
|
htmlCheckParagraph(ctxt);
|
||||||
|
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
|
||||||
|
(ctxt->sax->characters != NULL))
|
||||||
|
ctxt->sax->characters(ctxt->userData,
|
||||||
|
BAD_CAST "</", 2);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
if ((!terminate) &&
|
if ((!terminate) &&
|
||||||
(htmlParseLookupGt(ctxt) < 0))
|
(htmlParseLookupGt(ctxt) < 0))
|
||||||
goto done;
|
goto done;
|
||||||
|
Reference in New Issue
Block a user