]> granicus.if.org Git - icu/commitdiff
ICU-21024 RBBI Table Builder / Coverity CID 1460598 "Dodgy Code" issue
authorAndy Heninger <andy.heninger@gmail.com>
Fri, 20 Mar 2020 21:19:44 +0000 (14:19 -0700)
committerAndy Heninger <andy.heninger@gmail.com>
Sat, 21 Mar 2020 20:22:23 +0000 (13:22 -0700)
Fix the issue identified by Coverity.
The problem was in code handling the mapping from the table build time
representation of a set of status values for an RBBI rule to the corresponding
status data as saved in a binary RBBI rule file.

The problem was benign, the rbbi data built by the incorrect code would
would still operate correctly, although it might not byte-for-byte match
that built by ICU4C. (The problem was in Java only.)

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

index c5ae21d6c4fabac2c148aa93aa5495d7ba3a49b2..4e1a1b7f6b3d09faf0aee4d39d8945ee8fe9be2d 100644 (file)
@@ -814,12 +814,12 @@ class RBBITableBuilder {
                fRB.fRuleStatusVals.add(Integer.valueOf(1));    // Num of statuses in group
                fRB.fRuleStatusVals.add(Integer.valueOf(0));    //   and our single status of zero
 
-               SortedSet<Integer> s0 = new TreeSet<>();
-               Integer izero = Integer.valueOf(0);
-               fRB.fStatusSets.put(s0, izero);
-               SortedSet<Integer> s1 = new TreeSet<>();
-               s1.add(izero);
-               fRB.fStatusSets.put(s0, izero);
+               SortedSet<Integer> s0 = new TreeSet<>();        // mapping for rules with no explicit tagging
+               fRB.fStatusSets.put(s0, Integer.valueOf(0));    //   (key is an empty set).
+
+               SortedSet<Integer> s1 = new TreeSet<>();        // mapping for rules with explicit tagging of {0}
+               s1.add(Integer.valueOf(0));
+               fRB.fStatusSets.put(s1, Integer.valueOf(0));
            }
 
            //    For each state, check whether the state's status tag values are