Project

Profile

Help

Bug #6061

closed

Crash in SaxonCS using ";n" in regex flags

Added by Michael Kay 11 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2023-06-02
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET

Description

I’m evaluating SaxonCS 12.2. When I do a transform using SaxonCS.exe with the attached XSLT I get the error below. It happens when the XSLT contains a regular expression with the “;n” flag (i.e. using the .net regex engine). In the example I use analyze-string, but I can reproduce this with other regex-methods as well. It works without the “;n” flag.

<xsl:analyze-string select="." regex="a" flags=";n">

Saxon license expires in 19 days
System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length')
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Saxon.Hej.regex.JRegexIterator.next()
   at Saxon.Hej.om.FocusTrackingIterator.next()
   at Saxon.Hej.expr.instruct.AnalyzeString.AnalyzeStringElaborator.<>c__DisplayClass1_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Copy.CopyElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
System.Exception: Internal error evaluating template rule  at line 14 in module file:///D:/Temp/saxontest/template.xslt
---> System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length')
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Saxon.Hej.regex.JRegexIterator.next()
   at Saxon.Hej.om.FocusTrackingIterator.next()
   at Saxon.Hej.expr.instruct.AnalyzeString.AnalyzeStringElaborator.<>c__DisplayClass1_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Copy.CopyElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   at Saxon.Hej.trans.Mode.handleRuleNotNull(Rule rule, TraceListener traceListener, XPathContextMajor context, Item item, TemplateRule previousTemplate, ParameterSet parameters, ParameterSet tunnelParameters, Outputter output)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.trans.rules.ShallowCopyRuleSet.process(Item item, ParameterSet parameters, ParameterSet tunnelParams, Outputter out, XPathContext context, Location locationId)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.trans.XsltController.applyTemplates(Sequence source, Receiver out)
   at Saxon.Hej.s9api.AbstractXsltTransformer.applyTemplatesToSource(Source source, Receiver out)
   at Saxon.Hej.s9api.Xslt30Transformer.applyTemplates(Source source, Destination destination)
   at Saxon.Hej.Transform.processFile(Source source, XsltExecutable sheet, File outputFile, CommandLineOptions options)
   at Saxon.Hej.Transform.doTransform(String[] args)
Fatal error during transformation: Exception: Internal error evaluating template rule  at line 14 in module file:///D:/Temp/saxontest/template.xslt
Exiting with code 2

Please register to edit this issue

Also available in: Atom PDF