1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-08 21:42:07 +03:00

Exit after compilation of invalid func:result

Second part of bug #680920.
This commit is contained in:
Nick Wellnhofer
2012-08-15 21:09:19 +02:00
committed by Daniel Veillard
parent 14ee81b06c
commit aebfee35d1
5 changed files with 25 additions and 0 deletions

View File

@@ -562,6 +562,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exsltFuncResultElem: only xsl:fallback is " "exsltFuncResultElem: only xsl:fallback is "
"allowed to follow func:result\n"); "allowed to follow func:result\n");
style->errors++;
return (NULL); return (NULL);
} }
/* it is an error for a func:result element to not be a descendant /* it is an error for a func:result element to not be a descendant
@@ -578,6 +579,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"func:result element not a descendant " "func:result element not a descendant "
"of a func:function\n"); "of a func:function\n");
style->errors++;
return (NULL); return (NULL);
} }
if ((test->ns != NULL) && if ((test->ns != NULL) &&
@@ -589,6 +591,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"func:result element not allowed within" "func:result element not allowed within"
" another func:result element\n"); " another func:result element\n");
style->errors++;
return (NULL); return (NULL);
} }
} }
@@ -598,6 +601,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"func:result element not allowed within" "func:result element not allowed within"
" a variable binding element\n"); " a variable binding element\n");
style->errors++;
return (NULL); return (NULL);
} }
} }
@@ -611,6 +615,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
xsltPrintErrorContext(NULL, NULL, NULL); xsltPrintErrorContext(NULL, NULL, NULL);
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exsltFuncResultComp : malloc failed\n"); "exsltFuncResultComp : malloc failed\n");
style->errors++;
return (NULL); return (NULL);
} }
memset(ret, 0, sizeof(exsltFuncResultPreComp)); memset(ret, 0, sizeof(exsltFuncResultPreComp));

1
tests/docs/bug-174.xml Normal file
View File

@@ -0,0 +1 @@
<doc/>

View File

@@ -0,0 +1 @@
exsltFuncResultElem: only xsl:fallback is allowed to follow func:result

View File

18
tests/general/bug-174.xsl Normal file
View File

@@ -0,0 +1,18 @@
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:func = "http://exslt.org/functions"
version="1.0" extension-element-prefixes="func">
<func:function name="func:uaf">
<func:result/>
<func:result/>
</func:function>
<xsl:template match="/">
<result>
<xsl:value-of select="func:uaf()"/>
</result>
</xsl:template>
</xsl:stylesheet>