From d7e40df284c2557e4ca1a4a7f36b9036b20a7627 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Fri, 20 Mar 2020 14:19:44 -0700 Subject: [PATCH] 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.) --- .../core/src/com/ibm/icu/text/RBBITableBuilder.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/RBBITableBuilder.java b/icu4j/main/classes/core/src/com/ibm/icu/text/RBBITableBuilder.java index c5ae21d6c4f..4e1a1b7f6b3 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/RBBITableBuilder.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/RBBITableBuilder.java @@ -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 s0 = new TreeSet<>(); - Integer izero = Integer.valueOf(0); - fRB.fStatusSets.put(s0, izero); - SortedSet s1 = new TreeSet<>(); - s1.add(izero); - fRB.fStatusSets.put(s0, izero); + SortedSet s0 = new TreeSet<>(); // mapping for rules with no explicit tagging + fRB.fStatusSets.put(s0, Integer.valueOf(0)); // (key is an empty set). + + SortedSet 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