mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-02-05 05:47:00 +03:00
malloc-fail: Fix null deref in xmlGet{Min,Max}Occurs
Also report memory error in xmlSchemaGetNodeContent. Found with libFuzzer, see #344.
This commit is contained in:
parent
7762e8eda1
commit
0263b35756
@ -4760,6 +4760,8 @@ xmlSchemaGetNodeContent(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node)
|
||||
val = xmlStrdup((xmlChar *)"");
|
||||
ret = xmlDictLookup(ctxt->dict, val, -1);
|
||||
xmlFree(val);
|
||||
if (ret == NULL)
|
||||
xmlSchemaPErrMemory(ctxt, "getting node content", node);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -6103,6 +6105,8 @@ xmlGetMaxOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
|
||||
if (attr == NULL)
|
||||
return (def);
|
||||
val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
|
||||
if (val == NULL)
|
||||
return (def);
|
||||
|
||||
if (xmlStrEqual(val, (const xmlChar *) "unbounded")) {
|
||||
if (max != UNBOUNDED) {
|
||||
@ -6177,6 +6181,8 @@ xmlGetMinOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
|
||||
if (attr == NULL)
|
||||
return (def);
|
||||
val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
|
||||
if (val == NULL)
|
||||
return (def);
|
||||
cur = val;
|
||||
while (IS_BLANK_CH(*cur))
|
||||
cur++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user