summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/libxslt/src/libxslt/transform.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libxslt/src/libxslt/transform.c')
-rw-r--r--chromium/third_party/libxslt/src/libxslt/transform.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/chromium/third_party/libxslt/src/libxslt/transform.c b/chromium/third_party/libxslt/src/libxslt/transform.c
index 13793914f5d..fd02369cb00 100644
--- a/chromium/third_party/libxslt/src/libxslt/transform.c
+++ b/chromium/third_party/libxslt/src/libxslt/transform.c
@@ -232,6 +232,8 @@ xsltTemplateParamsCleanup(xsltTransformContextPtr ctxt)
ctxt->vars = NULL;
}
+#ifdef WITH_PROFILER
+
/**
* profPush:
* @ctxt: the transformation context
@@ -340,6 +342,8 @@ profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent)
}
}
+#endif /* WITH_PROFILER */
+
/**
* xsltPreCompEval:
* @ctxt: transform context
@@ -1090,6 +1094,8 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target,
if ((copy->content = xmlStrdup(cur->content)) == NULL)
return NULL;
}
+
+ ctxt->lasttext = NULL;
} else {
/*
* normal processing. keep counters to extend the text node
@@ -2205,6 +2211,7 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
}
}
+#ifdef WITH_DEBUGGER
static xmlNodePtr
xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
xmlNodePtr contextNode,
@@ -2240,6 +2247,7 @@ xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
}
return(debugedNode);
}
+#endif /* WITH_DEBUGGER */
/**
* xsltLocalVariablePush:
@@ -2411,6 +2419,17 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
*/
cur = list;
while (cur != NULL) {
+ if (ctxt->opLimit != 0) {
+ if (ctxt->opCount >= ctxt->opLimit) {
+ xsltTransformError(ctxt, NULL, cur,
+ "xsltApplySequenceConstructor: "
+ "Operation limit exceeded\n");
+ ctxt->state = XSLT_STATE_STOPPED;
+ goto error;
+ }
+ ctxt->opCount += 1;
+ }
+
ctxt->inst = cur;
#ifdef WITH_DEBUGGER
@@ -2867,6 +2886,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
/*
* Search if there are fallbacks
*/
+ ctxt->insert = insert;
child = cur->children;
while (child != NULL) {
if ((IS_XSLT_ELEM(child)) &&
@@ -2878,6 +2898,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
}
child = child->next;
}
+ ctxt->insert = oldInsert;
if (!found) {
xsltTransformError(ctxt, NULL, cur,
@@ -3086,10 +3107,12 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
xsltStackElemPtr withParams)
{
int oldVarsBase = 0;
- long start = 0;
xmlNodePtr cur;
xsltStackElemPtr tmpParam = NULL;
xmlDocPtr oldUserFragmentTop;
+#ifdef WITH_PROFILER
+ long start = 0;
+#endif
#ifdef XSLT_REFACTORED
xsltStyleItemParamPtr iparam;
@@ -3144,12 +3167,16 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
ctxt->varsBase = ctxt->varsNr;
ctxt->node = contextNode;
+
+#ifdef WITH_PROFILER
if (ctxt->profile) {
templ->nbCalls++;
start = xsltTimestamp();
profPush(ctxt, 0);
profCallgraphAdd(templ, ctxt->templ);
}
+#endif
+
/*
* Push the xsl:template declaration onto the stack.
*/
@@ -3257,6 +3284,8 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
* Pop the xsl:template declaration from the stack.
*/
templPop(ctxt);
+
+#ifdef WITH_PROFILER
if (ctxt->profile) {
long spent, child, total, end;
@@ -3277,6 +3306,7 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
if (ctxt->profNr > 0)
ctxt->profTab[ctxt->profNr - 1] += total;
}
+#endif
#ifdef WITH_DEBUGGER
if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) {
@@ -3434,7 +3464,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
* XPath expression.
* (see http://xml.apache.org/xalan-j/extensionslib.html#redirect)
*/
- cmp = xmlXPathCompile(URL);
+ cmp = xmlXPathCtxtCompile(ctxt->xpathCtxt, URL);
val = xsltEvalXPathString(ctxt, cmp);
xmlXPathFreeCompExpr(cmp);
xmlFree(URL);
@@ -4997,7 +5027,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
break;
}
}
- /* no break on purpose */
+ /* Intentional fall-through */
case XML_ELEMENT_NODE:
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
@@ -5897,8 +5927,16 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
ctxt->initialContextDoc = doc;
ctxt->initialContextNode = (xmlNodePtr) doc;
- if (profile != NULL)
+ if (profile != NULL) {
+#ifdef WITH_PROFILER
ctxt->profile = 1;
+#else
+ xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
+ "xsltApplyStylesheetInternal: "
+ "libxslt compiled without profiler\n");
+ goto error;
+#endif
+ }
if (output != NULL)
ctxt->outputFile = output;
@@ -6173,9 +6211,12 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
}
}
xmlXPathFreeNodeSet(ctxt->nodeList);
+
+#ifdef WITH_PROFILER
if (profile != NULL) {
xsltSaveProfiling(ctxt, profile);
}
+#endif
/*
* Be pedantic.