Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: third_party/libxslt/libexslt/functions.c

Issue 2777943003: Roll libxslt to ac341cbd792ee572941cc9a66e73800219a1a386 (Closed)
Patch Set: Update README.chromium. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libxslt/libexslt/Makefile.in ('k') | third_party/libxslt/libxslt/Makefile.am » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libexslt/functions.c
diff --git a/third_party/libxslt/libexslt/functions.c b/third_party/libxslt/libexslt/functions.c
index b49fbe6c32aa09a3bdfa982a79e2dd9f3e8c171f..c20ca16b48adfbe9ab4f17c7de226fdc29aeaea2 100644
--- a/third_party/libxslt/libexslt/functions.c
+++ b/third_party/libxslt/libexslt/functions.c
@@ -332,6 +332,21 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
}
/*
+ * When a function is called recursively during evaluation of its
+ * arguments, the recursion check in xsltApplySequenceConstructor
+ * isn't reached.
+ */
+ if (tctxt->depth >= tctxt->maxTemplateDepth) {
+ xsltTransformError(tctxt, NULL, NULL,
+ "exsltFuncFunctionFunction: Potentially infinite recursion "
+ "detected in function {%s}%s.\n",
+ ctxt->context->functionURI, ctxt->context->function);
+ tctxt->state = XSLT_STATE_STOPPED;
+ return;
+ }
+ tctxt->depth++;
+
+ /*
* We have a problem with the evaluation of function parameters.
* The original library code did not evaluate XPath expressions until
* the last moment. After version 1.1.17 of the libxslt, the logic
@@ -413,7 +428,7 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xsltFreeStackElemList(params);
if (data->error != 0)
- return;
+ goto error;
if (data->result != NULL) {
ret = data->result;
@@ -441,10 +456,13 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
"executing a function\n",
ctxt->context->functionURI, ctxt->context->function);
xmlFreeNode(fake);
- return;
+ goto error;
}
xmlFreeNode(fake);
valuePush(ctxt, ret);
+
+error:
+ tctxt->depth--;
}
« no previous file with comments | « third_party/libxslt/libexslt/Makefile.in ('k') | third_party/libxslt/libxslt/Makefile.am » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698