1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-04-24 18:50:07 +03:00

malloc-fail: Fix null deref in xmlAddDefAttrs

Found with libFuzzer, see #344.
This commit is contained in:
Nick Wellnhofer 2023-01-22 16:52:39 +01:00
parent 2355eac59e
commit bd9de3a31f

View File

@ -1274,6 +1274,8 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt,
/* intern the string and precompute the end */
len = xmlStrlen(value);
value = xmlDictLookup(ctxt->dict, value, len);
if (value == NULL)
goto mem_error;
defaults->values[5 * defaults->nbAttrs + 2] = value;
defaults->values[5 * defaults->nbAttrs + 3] = value + len;
if (ctxt->external)