[libxslt] Exit after compilation of invalid func:result



commit aebfee35d1106035dddf897e0e81d72d110b5e63
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Aug 15 21:09:19 2012 +0200

    Exit after compilation of invalid func:result
    
    Second part of bug #680920.

 libexslt/functions.c      |    5 +++++
 tests/docs/bug-174.xml    |    1 +
 tests/general/bug-174.err |    1 +
 tests/general/bug-174.xsl |   18 ++++++++++++++++++
 4 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/libexslt/functions.c b/libexslt/functions.c
index e7bb2f1..159e93d 100644
--- a/libexslt/functions.c
+++ b/libexslt/functions.c
@@ -562,6 +562,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
 	xsltGenericError(xsltGenericErrorContext,
 			 "exsltFuncResultElem: only xsl:fallback is "
 			 "allowed to follow func:result\n");
+	style->errors++;
 	return (NULL);
     }
     /* 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,
 			     "func:result element not a descendant "
 			     "of a func:function\n");
+	    style->errors++;
 	    return (NULL);
 	}
 	if ((test->ns != NULL) &&
@@ -589,6 +591,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
 		xsltGenericError(xsltGenericErrorContext,
 				 "func:result element not allowed within"
 				 " another func:result element\n");
+	        style->errors++;
 		return (NULL);
 	    }
 	}
@@ -598,6 +601,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
 	    xsltGenericError(xsltGenericErrorContext,
 			     "func:result element not allowed within"
 			     " a variable binding element\n");
+            style->errors++;
 	    return (NULL);
 	}
     }
@@ -611,6 +615,7 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
 	xsltPrintErrorContext(NULL, NULL, NULL);
         xsltGenericError(xsltGenericErrorContext,
                          "exsltFuncResultComp : malloc failed\n");
+        style->errors++;
         return (NULL);
     }
     memset(ret, 0, sizeof(exsltFuncResultPreComp));
diff --git a/tests/docs/bug-174.xml b/tests/docs/bug-174.xml
new file mode 100644
index 0000000..69d62f2
--- /dev/null
+++ b/tests/docs/bug-174.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/general/bug-174.err b/tests/general/bug-174.err
new file mode 100644
index 0000000..bc790a3
--- /dev/null
+++ b/tests/general/bug-174.err
@@ -0,0 +1 @@
+exsltFuncResultElem: only xsl:fallback is allowed to follow func:result
diff --git a/tests/general/bug-174.out b/tests/general/bug-174.out
new file mode 100644
index 0000000..e69de29
diff --git a/tests/general/bug-174.xsl b/tests/general/bug-174.xsl
new file mode 100644
index 0000000..51991ef
--- /dev/null
+++ b/tests/general/bug-174.xsl
@@ -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>
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]