[LIBXSLT] Update to version 1.1.34. CORE-16952

This commit is contained in:
Thomas Faber 2020-04-24 09:25:23 +02:00
parent f22fa382fe
commit b01a480163
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
22 changed files with 657 additions and 374 deletions

View file

@ -197,6 +197,8 @@ xsltTemplateParamsCleanup(xsltTransformContextPtr ctxt)
ctxt->vars = NULL;
}
#ifdef WITH_PROFILER
/**
* profPush:
* @ctxt: the transformation context
@ -305,6 +307,8 @@ profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent)
}
}
#endif /* WITH_PROFILER */
/**
* xsltPreCompEval:
* @ctxt: transform context
@ -1055,6 +1059,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
@ -2170,6 +2176,7 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
}
}
#ifdef WITH_DEBUGGER
static xmlNodePtr
xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
xmlNodePtr contextNode,
@ -2205,6 +2212,7 @@ xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
}
return(debugedNode);
}
#endif /* WITH_DEBUGGER */
/**
* xsltLocalVariablePush:
@ -2376,6 +2384,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
@ -2832,6 +2851,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
/*
* Search if there are fallbacks
*/
ctxt->insert = insert;
child = cur->children;
while (child != NULL) {
if ((IS_XSLT_ELEM(child)) &&
@ -2843,6 +2863,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
}
child = child->next;
}
ctxt->insert = oldInsert;
if (!found) {
xsltTransformError(ctxt, NULL, cur,
@ -3051,10 +3072,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;
@ -3109,12 +3132,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.
*/
@ -3222,6 +3249,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;
@ -3242,6 +3271,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)) {
@ -3399,7 +3429,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);
@ -3458,10 +3488,11 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
*/
if (ctxt->sec != NULL) {
ret = xsltCheckWrite(ctxt->sec, ctxt, filename);
if (ret == 0) {
xsltTransformError(ctxt, NULL, inst,
"xsltDocumentElem: write rights for %s denied\n",
filename);
if (ret <= 0) {
if (ret == 0)
xsltTransformError(ctxt, NULL, inst,
"xsltDocumentElem: write rights for %s denied\n",
filename);
xmlFree(URL);
xmlFree(filename);
return;
@ -4962,7 +4993,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:
@ -5862,8 +5893,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;
@ -5976,6 +6015,13 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
res->encoding = xmlStrdup(encoding);
variables = style->variables;
ctxt->node = (xmlNodePtr) doc;
ctxt->output = res;
ctxt->xpathCtxt->contextSize = 1;
ctxt->xpathCtxt->proximityPosition = 1;
ctxt->xpathCtxt->node = NULL; /* TODO: Set the context node here? */
/*
* Start the evaluation, evaluate the params, the stylesheets globals
* and start by processing the top node.
@ -5985,7 +6031,6 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
/*
* Evaluate global params and user-provided params.
*/
ctxt->node = (xmlNodePtr) doc;
if (ctxt->globalVars == NULL)
ctxt->globalVars = xmlHashCreate(20);
if (params != NULL) {
@ -6000,14 +6045,9 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
/* Clean up any unused RVTs. */
xsltReleaseLocalRVTs(ctxt, NULL);
ctxt->node = (xmlNodePtr) doc;
ctxt->output = res;
ctxt->insert = (xmlNodePtr) res;
ctxt->varsBase = ctxt->varsNr - 1;
ctxt->xpathCtxt->contextSize = 1;
ctxt->xpathCtxt->proximityPosition = 1;
ctxt->xpathCtxt->node = NULL; /* TODO: Set the context node here? */
/*
* Start processing the source tree -----------------------------------
*/
@ -6137,9 +6177,12 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
}
}
xmlXPathFreeNodeSet(ctxt->nodeList);
#ifdef WITH_PROFILER
if (profile != NULL) {
xsltSaveProfiling(ctxt, profile);
}
#endif
/*
* Be pedantic.