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

malloc-fail: Add error check in htmlParseHTMLAttribute

This function must return NULL is an error occurs.

Found by OSS-Fuzz, see #344.
This commit is contained in:
Nick Wellnhofer 2023-03-17 12:40:46 +01:00
parent c81d0d04bf
commit 62f199ed7d

View File

@ -2844,6 +2844,10 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
out = &buffer[indx];
}
c = CUR_CHAR(l);
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(buffer);
return(NULL);
}
if (c < 0x80)
{ *out++ = c; bits= -6; }
else if (c < 0x800)