mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-29 21:46:59 +03:00
malloc-fail: Fix null deref in xmlSAX2AttributeInternal
Found with libFuzzer, see #344.
This commit is contained in:
parent
1aabc9db40
commit
0c5f40b788
34
SAX2.c
34
SAX2.c
@ -1335,25 +1335,25 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
|
||||
|
||||
/* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
|
||||
ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL);
|
||||
if (ret == NULL)
|
||||
goto error;
|
||||
|
||||
if (ret != NULL) {
|
||||
if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
|
||||
xmlNodePtr tmp;
|
||||
if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
|
||||
xmlNodePtr tmp;
|
||||
|
||||
ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
|
||||
tmp = ret->children;
|
||||
while (tmp != NULL) {
|
||||
tmp->parent = (xmlNodePtr) ret;
|
||||
if (tmp->next == NULL)
|
||||
ret->last = tmp;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
} else if (value != NULL) {
|
||||
ret->children = xmlNewDocText(ctxt->myDoc, value);
|
||||
ret->last = ret->children;
|
||||
if (ret->children != NULL)
|
||||
ret->children->parent = (xmlNodePtr) ret;
|
||||
}
|
||||
ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
|
||||
tmp = ret->children;
|
||||
while (tmp != NULL) {
|
||||
tmp->parent = (xmlNodePtr) ret;
|
||||
if (tmp->next == NULL)
|
||||
ret->last = tmp;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
} else if (value != NULL) {
|
||||
ret->children = xmlNewDocText(ctxt->myDoc, value);
|
||||
ret->last = ret->children;
|
||||
if (ret->children != NULL)
|
||||
ret->children->parent = (xmlNodePtr) ret;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
|
Loading…
x
Reference in New Issue
Block a user