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

malloc-fail: Fix buffer overread after htmlParseScript

Found by OSS-Fuzz, see #344.
This commit is contained in:
Nick Wellnhofer
2023-03-20 15:52:38 +01:00
parent b1319c902f
commit 44ecefc8cc

View File

@@ -3139,6 +3139,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
"Invalid char in CDATA 0x%X\n", cur);
}
NEXTL(l);
if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
buf[nbchar] = 0;
if (ctxt->sax->cdataBlock!= NULL) {
@@ -3152,7 +3153,6 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
nbchar = 0;
SHRINK;
}
NEXTL(l);
cur = CUR_CHAR(l);
}