Project

Profile

Help

Bug #5786

closed

Stack overflow in ExpressionTool.expressionSize()

Added by Michael Kay about 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...

Actions #1

Updated by Michael Kay about 1 year ago

  • Status changed from New to Resolved
  • Priority changed from Low to Normal
  • Applies to branch 11, trunk added
  • Fix Committed on Branch 11, trunk added
  • Platforms .NET, Java added

Function references in a function no longer contribute to the size exception when the reference is to an anonymous function (because this indicates an inline function).

Actions #2

Updated by Community Admin about 1 year ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.0 added

Bug issue fix applied in the Saxon 12.0 Major Release. Leaving this bug marked as Resolved until fix applied

Actions #3

Updated by O'Neil Delpratt about 1 year ago

  • Fixed in Maintenance Release 11.5 added

Bug applied in the Saxon 11.5 Maintenance release.

Actions #4

Updated by O'Neil Delpratt about 1 year ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF