summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2012-10-21 19:02:25 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2012-10-21 19:03:46 +0200
commitdc11b6b379a882418093ecc8adf11f6166682e8d (patch)
treecaeacb9ccf0735ad2c831aeeac43a1fea0d58af3
parent6c99c519d97e5fcbec7a9537d190efb442e4e833 (diff)
downloadlibxslt-dc11b6b379a882418093ecc8adf11f6166682e8d.tar.gz
libxslt-dc11b6b379a882418093ecc8adf11f6166682e8d.tar.bz2
libxslt-dc11b6b379a882418093ecc8adf11f6166682e8d.zip
Fix crash with empty xsl:key/@match attribute
See https://bugzilla.gnome.org/show_bug.cgi?id=685328 Also improve some xsl:key error messages.
-rw-r--r--libxslt/keys.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libxslt/keys.c b/libxslt/keys.c
index a9953383..b8f14556 100644
--- a/libxslt/keys.c
+++ b/libxslt/keys.c
@@ -312,8 +312,8 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
end = skipPredicate(match, end);
if (end <= 0) {
xsltTransformError(NULL, style, inst,
- "key pattern is malformed: %s",
- key->match);
+ "xsl:key : 'match' pattern is malformed: %s",
+ key->match);
if (style != NULL) style->errors++;
goto error;
}
@@ -322,7 +322,7 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
}
if (current == end) {
xsltTransformError(NULL, style, inst,
- "key pattern is empty\n");
+ "xsl:key : 'match' pattern is empty\n");
if (style != NULL) style->errors++;
goto error;
}
@@ -345,6 +345,12 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
}
current = end;
}
+ if (pattern == NULL) {
+ xsltTransformError(NULL, style, inst,
+ "xsl:key : 'match' pattern is empty\n");
+ if (style != NULL) style->errors++;
+ goto error;
+ }
#ifdef WITH_XSLT_DEBUG_KEYS
xsltGenericDebug(xsltGenericDebugContext,
" resulting pattern %s\n", pattern);
@@ -364,7 +370,7 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
#endif
if (key->comp == NULL) {
xsltTransformError(NULL, style, inst,
- "xsl:key : XPath pattern compilation failed '%s'\n",
+ "xsl:key : 'match' pattern compilation failed '%s'\n",
pattern);
if (style != NULL) style->errors++;
}
@@ -375,7 +381,7 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
#endif
if (key->usecomp == NULL) {
xsltTransformError(NULL, style, inst,
- "xsl:key : XPath pattern compilation failed '%s'\n",
+ "xsl:key : 'use' expression compilation failed '%s'\n",
use);
if (style != NULL) style->errors++;
}