Bug #1924
closedArrayIndexOutOfBounds in Chain.ChainIterator
100%
Description
One of the data structures used for implementing a Sequence in Saxon is the "Chain" structure. This is used in cases where (cursory) static analysis suggests that appending/prepending to the sequence is a likely operation. The data structure is therefore optimized for appending/prepending items, at the cost of finding items by position. If there is then an attempt to find an item by position, the data structure is consolidated to make this efficient. This is intended to work well for situations where a sequence is built incrementally, one item at a time, and is then processed using direct access (integer subscripting). However, the operation of consolidating the structure does not take account of the fact that there might be open iterators working on the original linked list. When the chain is consolidated, a subsequent use of such an iterator is liable to crash. Note that this does not require multi-threading, because it is quite possible for multiple iterators to be active on the same structure even within a single thread.
Please register to edit this issue