Permalink
Browse files

[bugfix] Function calls should check query watchdog to allow a user t…

…o stop a query caught in an endless recursion.
  • Loading branch information...
1 parent 4bcade8 commit 89d7648738ce2f5cbbef024c44c752f52edbdd30 @wolfgangmm wolfgangmm committed Mar 2, 2014
View
1 src/org/exist/xquery/DynamicFunctionCall.java
@@ -43,6 +43,7 @@ public void dump(ExpressionDumper dumper) {
@Override
public Sequence eval(Sequence contextSequence, Item contextItem)
throws XPathException {
+ context.proceed(this);
final Sequence funcSeq = functionExpr.eval(contextSequence, contextItem);
if (funcSeq.getCardinality() != Cardinality.EXACTLY_ONE)
{throw new XPathException(this, ErrorCodes.XPTY0004,
View
5 src/org/exist/xquery/FunctionCall.java
@@ -271,6 +271,7 @@ public Sequence evalFunction(Sequence contextSequence, Item contextItem, Sequenc
}
public Sequence evalFunction(Sequence contextSequence, Item contextItem, Sequence[] seq, DocumentSet[] contextDocs) throws XPathException {
+ context.proceed(this);
if(context.isProfilingEnabled()) {
context.getProfiler().start(this);
context.getProfiler().message(this, Profiler.DEPENDENCIES, "DEPENDENCIES", Dependency.getDependenciesName(this.getDependencies()));
@@ -327,7 +328,9 @@ public Sequence evalFunction(Sequence contextSequence, Item contextItem, Sequenc
returnSeq = expression.eval(contextSequence, contextItem);
while(returnSeq instanceof DeferredFunctionCall &&
functionDef.getSignature().equals(((DeferredFunctionCall)returnSeq).getSignature())) {
- LOG.trace("Executing function: " + functionDef.getSignature());
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Executing function: " + functionDef.getSignature());
+ }
returnSeq = ((DeferredFunctionCall) returnSeq).execute();
}
View
1 src/org/exist/xquery/InternalFunctionCall.java
@@ -34,6 +34,7 @@ public InternalFunctionCall(Function f)
public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException
{
+ context.proceed(this);
final QName functionName = function.getName();
//check access to the method
try {

0 comments on commit 89d7648

Please sign in to comment.