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

malloc-fail: Fix null deref in xmlXIncludeLoadTxt

Found with libFuzzer, see #344.
This commit is contained in:
Nick Wellnhofer 2023-02-04 15:00:54 +01:00
parent a3749551e6
commit dc2dde1ab9

View File

@ -1732,6 +1732,12 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url,
xmlCharEncCloseFunc(buf->encoder);
buf->encoder = xmlGetCharEncodingHandler(enc);
node = xmlNewDocText(ctxt->doc, NULL);
if (node == NULL) {
xmlFreeInputStream(inputStream);
xmlFreeParserCtxt(pctxt);
xmlFree(URL);
return(-1);
}
/*
* Scan all chars from the resource and add the to the node