Project

Profile

Help

Bug #5341

closed

IndexOutOfRangeException:

Added by Jiri Dolejsi about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2022-02-21
Due date:
% Done:

100%

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

Files

cirkev.xml (6.24 KB) cirkev.xml Jiri Dolejsi, 2022-02-21 17:58
Actions #1

Updated by Jiri Dolejsi about 2 years ago

Transformation throws IndexOutOfBound exception, when 2 Unicode blue diamonds are present. When these 2 chars are not present, trasnformation finishes successfully. We are using SaxonCS 11.1. Chars are at rows 113 and 119. Document is in Czech language.

using System;
using Saxon.Api;
using System.IO;
using System.Globalization;

namespace TestSaxonCS
{
  class Program
  {

        static string xslt = @"
<xsl:stylesheet 
	xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
    version='3.0'>

	<xsl:template match = '/'>
        <xsl:sequence select = ""substring-after(/eventItem/contentMeta/scheduled/start, 'T')""/>
	</xsl:template>
</xsl:stylesheet>";
        static void Main(string[] args)
        {
            Processor processor = new Processor(true);
            XsltCompiler xsltCompiler = processor.NewXsltCompiler();
            xsltCompiler.XsltLanguageVersion = "3.0";
            var rdr = new StringReader(xslt);
            XsltExecutable exec = xsltCompiler.Compile(rdr);
            Xslt30Transformer transf = exec.Load30();
            XdmDestination dest = new XdmDestination();
            var stream = File.OpenRead("cirkev.xml");
            transf.ApplyTemplates(stream, dest);
        }
    }
}

Actions #2

Updated by Michael Kay about 2 years ago

  • Category set to Internals
  • Status changed from New to In Progress
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal

Thanks for reporting it. I have reproduced the problem.

Actions #3

Updated by Michael Kay about 2 years ago

Confirmed that the failure also occurs with SaxonJ.

Actions #4

Updated by Michael Kay about 2 years ago

In Slice24.indexOf(), line 61,

return (i - start)/3;

should read

return i/3 - start;

because i is a byte offset into the array-of-24-bit-codepoints, while start is a code point offset.

So the problem affects string indexing operations on Unicode strings held as 24-bits per character.

Rather surprising that none of our tests hit this one.

Actions #5

Updated by Michael Kay about 2 years ago

  • Status changed from In Progress to Resolved
  • Applies to branch 11, trunk added
  • Fix Committed on Branch 11, trunk added

Fix tested.

Actions #6

Updated by O'Neil Delpratt about 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 11.3 added

Bug fix applied in the Saxon 11.3 maintenance release.

Please register to edit this issue

Also available in: Atom PDF