Index: third_party/libxslt/libxslt/attributes.c |
diff --git a/third_party/libxslt/libxslt/attributes.c b/third_party/libxslt/libxslt/attributes.c |
index 2fa86e3c9632a396c2bc04171dc341c96921da59..8440b1031592ab61ddbf2bda003a4e2428ae41fb 100644 |
--- a/third_party/libxslt/libxslt/attributes.c |
+++ b/third_party/libxslt/libxslt/attributes.c |
@@ -297,9 +297,11 @@ xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) { |
return; |
value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL); |
- if (value == NULL) { |
+ if ((value == NULL) || (*value == 0)) { |
xsltGenericError(xsltGenericErrorContext, |
"xsl:attribute-set : name is missing\n"); |
+ if (value) |
+ xmlFree(value); |
return; |
} |
@@ -482,19 +484,27 @@ xsltGetSAS(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns) { |
} |
/** |
- * xsltResolveSASCallback,: |
+ * xsltResolveSASCallbackInt: |
* @style: the XSLT stylesheet |
* |
* resolve the references in an attribute set. |
*/ |
static void |
-xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, |
+xsltResolveSASCallbackInt(xsltAttrElemPtr values, xsltStylesheetPtr style, |
const xmlChar *name, const xmlChar *ns, |
- ATTRIBUTE_UNUSED const xmlChar *ignored) { |
+ int depth) { |
xsltAttrElemPtr tmp; |
xsltAttrElemPtr refs; |
tmp = values; |
+ if ((name == NULL) || (name[0] == 0)) |
+ return; |
+ if (depth > 100) { |
+ xsltGenericError(xsltGenericErrorContext, |
+ "xsl:attribute-set : use-attribute-sets recursion detected on %s\n", |
+ name); |
+ return; |
+ } |
while (tmp != NULL) { |
if (tmp->set != NULL) { |
/* |
@@ -519,7 +529,7 @@ xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, |
/* |
* recurse first for cleanup |
*/ |
- xsltResolveSASCallback(refs, style, name, ns, NULL); |
+ xsltResolveSASCallbackInt(refs, style, name, ns, depth + 1); |
/* |
* Then merge |
*/ |
@@ -537,6 +547,19 @@ xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, |
} |
/** |
+ * xsltResolveSASCallback,: |
+ * @style: the XSLT stylesheet |
+ * |
+ * resolve the references in an attribute set. |
+ */ |
+static void |
+xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, |
+ const xmlChar *name, const xmlChar *ns, |
+ ATTRIBUTE_UNUSED const xmlChar *ignored) { |
+ xsltResolveSASCallbackInt(values, style, name, ns, 1); |
+} |
+ |
+/** |
* xsltMergeSASCallback,: |
* @style: the XSLT stylesheet |
* |