#549 subsequence() crash

v8.7.3
closed
5
2012-10-08
2006-06-19
Michael Kay
No

The subsequence() function can fail with a
NegativeArraySizeException if the value if the second
argument is greater than the length of the sequence.

The problem occurs if the sequence identified in the
first argument is held in memory as a SequenceExtent,
rather than being evaluated using an iterator.

Source fix: in net.sf.saxon.expr.TailExpression, inner
class TailIterator at line 105, replace the methods
position() and getLastPosition() as follows:

    public int position() {
        int bp = base.position();
        return (bp > 0 ? (base.position() - start +

1) : bp);
}

   public int getLastPosition() throws XPathException {
        int bl =

((LastPositionFinder)base).getLastPosition() - start + 1;
return (bl > 0 ? bl : 0);
}

Test case: K-SeqSubsequenceFunc-21 in XQTS

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks