We're updating the issue view to help you get more done. 

Normalizer compose and decompose methods not returning the correct length

Description

To all-

The decompose method in Normalizer causes an
java.lang.IndexOutOfBoundsException when the destination buffer is not
oversized.

For example, the second call to decompose will raise the exception:
java.lang.IndexOutOfBoundsException: 18
at com.ibm.icu.text.Normalizer.decompose(Normalizer.java:1030)

char[] term = {'r','\u00e9','s','u','m','\u00e9' };
char[] decomposed_term = new char[+ term.length + 2|10];
int rc =
Normalizer.decompose(term,0,term.length;decomposed_term,0,decomposed_term.le
ngth,true,0);
rc =
Normalizer.decompose(term,0,term.length;decomposed_term,10,decomposed_term.l
ength,true,0);
The second call would stop raising an exception when decomposed_term is
allocated with a size of 10 + term.length + 12.
I think the problem is as follows:
NormalizerImpl.decompose is expected to return the number of characters
needed, but it actually returns destLimit. This causes the length check in
Normalizer.decompose to fail, when destStart gets larger.
Am I misunderstanding something?
Thanks
Isabelle

Isabelle.Moulinier@thomson.com
Ph: 651 687 3424

Environment

Status

Assignee

TracBot

Reporter

TracBot

Labels

tracCreated

Nov 14, 2003, 12:56 AM

tracOwner

ram

tracProject

ICU4J

tracReporter

Isabelle.Moulinier@6bd4b708a4144f99

tracResolution

fixed

tracReviewer

doug

tracStatus

closed

Components

Fix versions

Priority

blocker