mirror of
https://github.com/openharmony/third_party_libxml2.git
synced 2026-08-24 23:31:27 -04:00
安全漏洞修复CVE-2023-29469,CVE-2023-28484
Signed-off-by: fangyunzhong <fangyunzhong2@huawei.com>
This commit is contained in:
@@ -451,7 +451,8 @@ static unsigned long
|
||||
xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
|
||||
unsigned long value = seed;
|
||||
|
||||
if (name == NULL) return(0);
|
||||
if ((name == NULL) || (namelen <= 0))
|
||||
return(value);
|
||||
value += *name;
|
||||
value <<= 5;
|
||||
if (namelen > 10) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
./test/schemas/issue491_0.xsd:8: element complexType: Schemas parser error : complex type 'ChildType': The content type of both, the type and its base type, must either 'mixed' or 'element-only'.
|
||||
@@ -0,0 +1,2 @@
|
||||
./test/schemas/oss-fuzz-51295_0.xsd:2: element element: Schemas parser error : element decl. 'e': The element declaration 'e' defines a circular substitution group to element declaration 'e'.
|
||||
./test/schemas/oss-fuzz-51295_0.xsd:2: element element: Schemas parser error : element decl. 'e': The element declaration 'e' defines a circular substitution group to element declaration 'e'.
|
||||
@@ -0,0 +1 @@
|
||||
<Child xmlns="http://www.test.com">5</Child>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com" targetNamespace="http://www.test.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:complexType name="BaseType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:int" />
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="ChildType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="BaseType">
|
||||
<xs:sequence>
|
||||
<xs:element name="bad" type="xs:int" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
<xs:element name="Child" type="ChildType" />
|
||||
</xs:schema>
|
||||
@@ -0,0 +1 @@
|
||||
<e/>
|
||||
@@ -0,0 +1,4 @@
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="e" substitutionGroup="e"/>
|
||||
<xs:element name="t" substitutionGroup="e" type='xs:decimal'/>
|
||||
</xs:schema>
|
||||
+14
-3
@@ -13345,8 +13345,19 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl,
|
||||
* declaration `resolved` to by the `actual value`
|
||||
* of the substitutionGroup [attribute], if present"
|
||||
*/
|
||||
if (elemDecl->subtypes == NULL)
|
||||
elemDecl->subtypes = substHead->subtypes;
|
||||
if (elemDecl->subtypes == NULL) {
|
||||
if (substHead->subtypes == NULL) {
|
||||
/*
|
||||
* This can happen with self-referencing substitution
|
||||
* groups. The cycle will be detected later, but we have
|
||||
* to set subtypes to avoid null-pointer dereferences.
|
||||
*/
|
||||
elemDecl->subtypes = xmlSchemaGetBuiltInType(
|
||||
XML_SCHEMAS_ANYTYPE);
|
||||
} else {
|
||||
elemDecl->subtypes = substHead->subtypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -18608,7 +18619,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
|
||||
"allowed to appear inside other model groups",
|
||||
NULL, NULL);
|
||||
|
||||
} else if (! dummySequence) {
|
||||
} else if ((!dummySequence) && (baseType->subtypes != NULL)) {
|
||||
xmlSchemaTreeItemPtr effectiveContent =
|
||||
(xmlSchemaTreeItemPtr) type->subtypes;
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user