Bug #2735
closedArrayIndexOutOfBoundsException while evaluating regular expression
100%
Description
After upgrading from Saxon 9.4 to 9.6, a regular expression that worked
fine suddenly throws a java.lang.ArrayIndexOutOfBoundsException.
The expression attempts to normalize space between numbers and selected
SI units. Below is a stylesheet that isolates the problem.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/">
<test>
<xsl:value-of select="
replace('30 dB','
([0-9])\s+
(
(
[hkMGTPdcmµnpf]?([mgsAKNJWCVFSTHLl])
| ([ch]a|t|dB)
| ((k|Ki|[MGTP]i?)?(B|bit))
| (KB?)
)
(\W|$)
)
','$1 $2','x')"
/>
</test>
</xsl:template>
</xsl:stylesheet>
I tested it in oXygen 15.2 using Saxon-PE 9.5.1.3 and with several
version of Saxon 9.6 and 9.7 for .NET on Windows 7.
It works fine in Saxon 9.4, it also works fine in 9.5 and 9.6/7 when
using the native regex engine with flags "!" resp. ";j" or ";n". So I
guess it has something to do with the new Jakarta-based regex
implementation introduced in 9.5.
The error only occurs when there is a match.
Could it be a bug, or is the regular expression invalid (or simply too
horrible to be processed by decent regex matchers)?
Thanks,
regards,
Tom De Herdt
Please register to edit this issue