html: Fix pull-parsing of incomplete end tags

Handle this HTML5 quirk in htmlParseEndTag.
This commit is contained in:
Nick Wellnhofer 2025-02-01 00:17:01 +01:00
parent 4a776c78ec
commit 70bf754e24

View File

@ -3987,6 +3987,15 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
SKIP(2);
if (ctxt->input->cur >= ctxt->input->end) {
htmlCheckParagraph(ctxt);
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->characters != NULL))
ctxt->sax->characters(ctxt->userData,
BAD_CAST "</", 2);
return;
}
if (CUR == '>') {
SKIP(1);
return;
@ -5129,14 +5138,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
}
case XML_PARSER_END_TAG:
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;
}
if ((!terminate) &&
(htmlParseLookupGt(ctxt) < 0))
goto done;