1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

html: Fix quadratic behavior in htmlParseTryOrFinish

Fix check for end of script content.

Found by OSS-Fuzz.
This commit is contained in:
Nick Wellnhofer
2023-03-15 16:56:36 +01:00
parent 14c62e0dd3
commit 4b3452d171

View File

@@ -6000,9 +6000,15 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (idx < 0)
goto done;
val = in->cur[idx + 2];
if (val == 0) /* bad cut of input */
if (val == 0) { /* bad cut of input */
/*
* FIXME: htmlParseScript checks for additional
* characters after '</'.
*/
ctxt->checkIndex = idx;
goto done;
}
}
htmlParseScript(ctxt);
if ((cur == '<') && (next == '/')) {
ctxt->instate = XML_PARSER_END_TAG;