Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1019 (closed defect: fixed)

Opened 16 years ago

Last modified 16 years ago

Repeated calls to RegExpT's replaceAll causes invalid UTF-8 sequence

Reported by: gamerChad Assigned to: jascha
Priority: major Milestone: 0.99.7
Component: Packaging Version: 0.99.5 Jascha
Keywords: triage Cc:

Description

I am testing on Windows XP with DMD 1.027 and Tango v0.99.5.

import tango.io.Stdout;
import tango.text.Regex;

void main(char[][] args)
{
  scope crasher = new RegExpT!(char)("a");
  char[] result = "e".dup; // also crashes for "a"
  result = crasher.replaceAll(result, (RegExpT!(char) regex) { return "|".dup; } );
  result = crasher.replaceAll(result, (RegExpT!(char) regex) { return "e".dup; } );
}

The above code compiles but causes the following error when run: object.Exception: 4invalid UTF-8 sequence

If one of the calls to replaceAll is removed, it no longer crashes.

void main(char[][] args)
{
  scope foo = new RegExpT!(char)("b");
  scope bar = new RegExpT!(char)("a");
  char[] result = "e".dup;
  result = foo.replaceAll(result, (RegExpT!(char) regex) { return "|".dup; } );
  result = bar.replaceAll(result, (RegExpT!(char) regex) { return "e".dup; } );
}

This also causes the same crash. Note that the repeated calls to replaceAll don't need to be from the same RegExpT object. The version of replaceAll that accepts a string rather than a delegate does not seem to have this problem.

Change History

04/08/08 08:27:41 changed by jascha

  • status changed from new to assigned.

04/27/08 09:11:53 changed by larsivi

  • milestone changed from 0.99.6 to 0.99.7.

05/24/08 09:56:55 changed by larsivi

  • keywords set to triage.

07/02/08 18:41:28 changed by jascha

  • status changed from assigned to closed.
  • resolution set to fixed.

07/02/08 21:12:12 changed by jascha