Project

Profile

Help

Bug #2086

closed

ArrayIndexOutOfBounds handling regular expression

Added by Michael Kay over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
2014-06-08
Due date:
% Done:

0%

Estimated time:
Platforms:

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:

https://subversion.le-tex.de/common/sandbox/2014-06-07_CE_regex_range_minus/test.html?xsl=test_ok.xsl

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

Actions #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.

Actions #2

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);
Actions #3

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

Also available in: Atom PDF