]> granicus.if.org Git - icu/commitdiff
ICU-10880 Fix a potential infinite loop
authorGeorge Rhoten <grhoten@users.noreply.github.com>
Sat, 16 Aug 2014 08:59:45 +0000 (08:59 +0000)
committerGeorge Rhoten <grhoten@users.noreply.github.com>
Sat, 16 Aug 2014 08:59:45 +0000 (08:59 +0000)
X-SVN-Rev: 36179

icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java

index 3e34ed8f7c9ee4f69ea6b4138f40fb4d993a2593..3b26452bc70800e3b0a5edcc6c127586930a7f13 100644 (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());