Bug #2086
closedArrayIndexOutOfBounds handling regular expression
0%
Description
Reported on saxon-help list by Gerrit Imsieke:
I get a "SEVERE: Exception java.lang.IndexOutOfBoundsException in
renderXML: null" exception under very peculiar conditions.
This will raise the exception:
replace('a-d-0-9', '[^-0-9a-z_]', 'X', 'i')
Example:
https://subversion.le-tex.de/common/sandbox/2014-06-07_CE_regex_range_minus/test.html?xsl=test.xsl
These won’t raise the exception:
Changing the character range:
replace('a-d-0-9', '[^-0-9a-c_]', 'X', 'i')
Example:
Removing the 'i' flag:
replace('a-d-0-9', '[^-0-9a-z_]', 'X')
Moving the minus after the underscore:
replace('a-d-0-9', '[^0-9a-z_-]', 'X', 'i')
Removing the negation:
replace('a-d-0-9', '[-0-9a-z_]', 'X', 'i')
Gerrit
Filed in person during XML London:
https://twitter.com/gimsieke/status/475294067765809153/photo/1
Updated by Michael Kay over 10 years ago
There's a special path in the code to handle the ranges a-z and A-Z in the code for case-independent matching, so the symptoms aren't quite as weird as they may seem. (See RECompiler lines 612-616)
However, the same code appears to be present in the 9.5 branch and the problem doesn't occur there.
Updated by Michael Kay over 10 years ago
This is a bug which has at some stage been fixed in 9.5 but not in Saxon-CE. In class IntRangeSet, lines 342-343 read
System.arraycopy(startPoints, i, startPoints, i+1, used-i);
System.arraycopy(endPoints, i, endPoints, i+1, used-i);
which on the 9.5 branch has been corrected to:
System.arraycopy(startPoints, i, startPoints, i+1, used-i-1);
System.arraycopy(endPoints, i, endPoints, i+1, used-i-1);
Updated by Michael Kay over 10 years ago
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Sprint/Milestone set to Release 1.1
- Found in version set to 1.1
Patch applied on the CE 1.1 and 2.0 branches.
Please register to edit this issue