[LIBXSLT] Update to version 1.1.32. CORE-14291

This commit is contained in:
Thomas Faber 2018-02-04 15:52:31 +01:00
parent 5c72e50fd0
commit 5c0faa58cf
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
24 changed files with 945 additions and 911 deletions

View file

@ -85,6 +85,7 @@ struct _xsltCompMatch {
const xmlChar *mode; /* the mode */
const xmlChar *modeURI; /* the mode URI */
xsltTemplatePtr template; /* the associated template */
xmlNodePtr node; /* the containing element */
int direct;
/* TODO fix the statically allocated size steps[] */
@ -895,7 +896,9 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
xmlNodePtr matchNode, const xmlChar *mode,
const xmlChar *modeURI) {
int i;
int found = 0;
xmlNodePtr node = matchNode;
xmlNodePtr oldInst;
xsltStepOpPtr step, sel = NULL;
xsltStepStates states = {0, 0, NULL}; /* // may require backtrack */
@ -929,6 +932,10 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
return(0);
}
/* Some XPath functions rely on inst being set correctly. */
oldInst = ctxt->inst;
ctxt->inst = comp->node;
i = 0;
restart:
for (;i < comp->nbStep;i++) {
@ -1121,12 +1128,9 @@ restart:
* as possible this costly computation.
*/
if (comp->direct) {
if (states.states != NULL) {
/* Free the rollback states */
xmlFree(states.states);
}
return(xsltTestCompMatchDirect(ctxt, comp, matchNode,
comp->nsList, comp->nsNr));
found = xsltTestCompMatchDirect(ctxt, comp, matchNode,
comp->nsList, comp->nsNr);
goto exit;
}
if (!xsltTestPredicateMatch(ctxt, comp, node, step, sel))
@ -1166,18 +1170,19 @@ restart:
}
}
found:
found = 1;
exit:
ctxt->inst = oldInst;
if (states.states != NULL) {
/* Free the rollback states */
xmlFree(states.states);
}
return(1);
return found;
rollback:
/* got an error try to rollback */
if (states.states == NULL)
return(0);
if (states.nbstates <= 0) {
xmlFree(states.states);
return(0);
if (states.states == NULL || states.nbstates <= 0) {
found = 0;
goto exit;
}
states.nbstates--;
i = states.states[states.nbstates].step;
@ -1456,6 +1461,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
xsltTransformError(NULL, NULL, NULL,
"xsltCompileIdKeyPattern : ) expected\n");
ctxt->error = 1;
xmlFree(lit);
return;
}
}
@ -1618,6 +1624,7 @@ parse_node_test:
xsltTransformError(NULL, NULL, NULL,
"xsltCompileStepPattern : Name expected\n");
ctxt->error = 1;
xmlFree(URL);
goto error;
}
} else {
@ -1925,6 +1932,7 @@ xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc,
goto error;
ctxt->cur = &(ctxt->base)[current - start];
element->pattern = ctxt->base;
element->node = node;
element->nsList = xmlGetNsList(doc, node);
j = 0;
if (element->nsList != NULL) {