1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

Fix infinite loop in HTML parser introduced with recent commits

Check for XML_PARSER_EOF to avoid an infinite loop introduced with
recent changes to the HTML push parser.

Found by OSS-Fuzz.
This commit is contained in:
Nick Wellnhofer 2021-02-07 13:23:09 +01:00
parent acb3566739
commit 954696e7cf

View File

@ -5872,7 +5872,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing char data\n");
#endif
while ((cur != '<') && (in->cur < in->end)) {
while ((ctxt->instate != XML_PARSER_EOF) &&
(cur != '<') && (in->cur < in->end)) {
if (cur == '&') {
htmlParseReference(ctxt);
} else {