Skip to content
Snippets Groups Projects
Commit 5ac58eeab2d5 authored by Nick Wellnhofer's avatar Nick Wellnhofer
Browse files

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.
parent 8f28674f2493
Branches
No related tags found
No related merge requests found
......@@ -312,7 +312,7 @@
end = skipPredicate(match, end);
if (end <= 0) {
xsltTransformError(NULL, style, inst,
"key pattern is malformed: %s",
"xsl:key : 'match' pattern is malformed: %s",
key->match);
if (style != NULL) style->errors++;
goto error;
......@@ -322,7 +322,7 @@
}
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 @@
}
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 @@
#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 @@
#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++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment