ICU-21024 RBBI Table Builder / Coverity CID 1460598 "Dodgy Code" issue

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.)
This commit is contained in:
Andy Heninger 2020-03-20 14:19:44 -07:00
parent f6622ab2f1
commit d7e40df284

View File

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