Moved execution of xmlSchemaCheckDefaults to xmlSchemaTypeFixup; this
* xmlschemas.c: Moved execution of xmlSchemaCheckDefaults to
xmlSchemaTypeFixup; this ensures facets of inherited types to be checked
prior to facets of derived types - which caused a seg fault otherwise
(bug #158216, reported by Frans Englich).
diff --git a/xmlschemas.c b/xmlschemas.c
index ef76ec6..b664c9b 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -343,6 +343,9 @@
static int
xmlSchemaParseImport(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
xmlNodePtr node);
+static void
+xmlSchemaCheckDefaults(xmlSchemaTypePtr typeDecl,
+ xmlSchemaParserCtxtPtr ctxt, const xmlChar * name);
/************************************************************************
* *
@@ -12336,6 +12339,7 @@
item->subtypes->contentType;
}
xmlSchemaBuildAttributeValidation(ctxt, item);
+ xmlSchemaCheckDefaults(item, ctxt, item->name);
ctxt->ctxtType = ctxtType;
break;
}
@@ -12489,6 +12493,7 @@
* Check constraints.
*/
xmlSchemaCheckSRCSimpleType(ctxt, item);
+ xmlSchemaCheckDefaults(item, ctxt, item->name);
ctxt->ctxtType = ctxtType;
break;
case XML_SCHEMA_TYPE_SEQUENCE:
@@ -13534,8 +13539,7 @@
/*
* Then check the defaults part of the type like facets values
*/
- xmlHashScan(ret->typeDecl, (xmlHashScanner) xmlSchemaCheckDefaults,
- ctxt);
+ /* OLD: xmlHashScan(ret->typeDecl, (xmlHashScanner) xmlSchemaCheckDefaults, ctxt); */
/*
* Validate the value constraint of attribute declarations/uses.
@@ -14066,8 +14070,10 @@
}
/*
* Check facet values. Note that facets are
- * hold by complex and simple type components only.
+ * hold by simple type components only (and
+ * by complex types in the current implementation).
*/
+ /* OLD:
for (i = 0; i < nbItems; i++) {
item = items[i];
switch (item->type) {
@@ -14079,6 +14085,7 @@
break;
}
}
+ */
/*
* Build the content model for complex types.
*/