ICU-10880 Fix a potential infinite loop

X-SVN-Rev: 36179
This commit is contained in:
George Rhoten 2014-08-16 08:59:45 +00:00
parent 12a1765e44
commit a1213c49b1

View file

@ -727,7 +727,7 @@ public class PluralFormat extends UFormat {
int matchedIndex = -1;
// Iterate over (ARG_SELECTOR ARG_START message ARG_LIMIT) tuples
// until the end of the plural-only pattern.
do {
while (partIndex < count) {
MessagePattern.Part partSelector=msgPattern.getPart(partIndex++);
if (partSelector.getType() != MessagePattern.Part.Type.ARG_SELECTOR) {
// Bad format
@ -760,7 +760,7 @@ public class PluralFormat extends UFormat {
matchedWord = currArg;
keyword = pattern.substring(partStart.getLimit(), partLimit.getIndex());
}
} while(partIndex<count);
}
if (keyword != null) {
pos.setBeginIndex(matchedIndex);
pos.setEndIndex(matchedIndex + matchedWord.length());