1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

html: Fix corner case when push-parsing HTML5 comments

This commit is contained in:
Nick Wellnhofer
2025-01-31 22:51:59 +01:00
parent e48fb5e4f2
commit ba1537374b

View File

@ -4899,8 +4899,14 @@ htmlParseLookupCommentEnd(htmlParserCtxtPtr ctxt)
mark = htmlParseLookupString(ctxt, 2, "--", 2, 0); mark = htmlParseLookupString(ctxt, 2, "--", 2, 0);
if (mark < 0) if (mark < 0)
break; break;
/*
* <!--> is a complete comment, but
* <!--!> is not
* <!---!> is not
* <!----!> is
*/
if ((NXT(mark+2) == '>') || if ((NXT(mark+2) == '>') ||
((NXT(mark+2) == '!') && (NXT(mark+3) == '>'))) { ((mark >= 4) && (NXT(mark+2) == '!') && (NXT(mark+3) == '>'))) {
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
break; break;
} }