Project

Profile

Help

Bug #5786

closed

Stack overflow in ExpressionTool.expressionSize()

Added by Michael Kay over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2022-12-30
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

A stack overflow (infinite recursion) occurs in ExpressionTool.expressionSize() if a function A contains as a subexpression a reference to a function B which itself contains a call on A. Example:

xquery version "3.1";
module namespace cmp = "http://www.w3.org/qt4cg/compare";
declare function cmp:compare($x as node(), $y as node()) as xs:boolean {
    if ($x instance of document-node() and $y instance of document-node()) then
        cmp:compare-content($x, $y)
    else....
    
};

declare function cmp:compare-content($x as node(), $y as node()) as xs:boolean {
   if (count($x/node()) ne count($y/node()))
   then trace(false(), "different numbers of children")
   else every $child-comparison in for-each-pair($x/node(), $y/node(), cmp:compare#2) satisfies $child-comparison
};

There's a comment pointing to bug #5054...

Please register to edit this issue

Also available in: Atom PDF