MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathCheckOpLimit

Function xmlXPathCheckOpLimit

ThirdParty/libxml2/vtklibxml2/xpath.c:746–759  ·  view source on GitHub ↗

* xmlXPathCheckOpLimit: * @ctxt: the XPath Parser context * @opCount: the number of operations to be added * * Adds opCount to the running total of operations and returns -1 if the * operation limit is exceeded. Returns 0 otherwise. */

Source from the content-addressed store, hash-verified

744 * operation limit is exceeded. Returns 0 otherwise.
745 */
746static int
747xmlXPathCheckOpLimit(xmlXPathParserContextPtr ctxt, unsigned long opCount) {
748 xmlXPathContextPtr xpctxt = ctxt->context;
749
750 if ((opCount > xpctxt->opLimit) ||
751 (xpctxt->opCount > xpctxt->opLimit - opCount)) {
752 xpctxt->opCount = xpctxt->opLimit;
753 xmlXPathErr(ctxt, XPATH_OP_LIMIT_EXCEEDED);
754 return(-1);
755 }
756
757 xpctxt->opCount += opCount;
758 return(0);
759}
760
761#define OP_LIMIT_EXCEEDED(ctxt, n) \
762 ((ctxt->context->opLimit != 0) && (xmlXPathCheckOpLimit(ctxt, n) < 0))

Callers 4

xmlXPathCompOpEvalFirstFunction · 0.85
xmlXPathCompOpEvalLastFunction · 0.85
xmlXPathCompOpEvalFunction · 0.85

Calls 1

xmlXPathErrFunction · 0.85

Tested by

no test coverage detected