summaryrefslogtreecommitdiff
path: root/external/icu/icu-ubsan.patch.0
blob: 5f9e85f502eb3c874890a2a124017415c1ee1a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--- source/common/rbbidata.h
+++ source/common/rbbidata.h
@@ -113,7 +113,7 @@
                                     /*     StatusTable of the set of matching             */
                                     /*     tags (rule status values)                      */
     int16_t          fReserved;
-    uint16_t         fNextState[2]; /*  Next State, indexed by char category.             */
+    uint16_t         fNextState[1]; /*  Next State, indexed by char category.             */
                                     /*  This array does not have two elements             */
                                     /*    Array Size is actually fData->fHeader->fCatCount         */
                                     /*    CAUTION:  see RBBITableBuilder::getTableSize()  */
--- source/common/rbbitblb.cpp
+++ source/common/rbbitblb.cpp
@@ -1072,10 +1072,10 @@
     numRows = fDStates->size();
     numCols = fRB->fSetBuilder->getNumCharCategories();
 
-    //  Note  The declaration of RBBIStateTableRow is for a table of two columns.
-    //        Therefore we subtract two from numCols when determining
+    //  Note  The declaration of RBBIStateTableRow is for a table of one columns.
+    //        Therefore we subtract one from numCols when determining
     //        how much storage to add to a row for the total columns.
-    rowSize = sizeof(RBBIStateTableRow) + sizeof(uint16_t)*(numCols-2);
+    rowSize = sizeof(RBBIStateTableRow) + sizeof(uint16_t)*(numCols-1);
     size   += numRows * rowSize;
     return size;
 }
@@ -1105,7 +1105,7 @@
     }
 
     table->fRowLen    = sizeof(RBBIStateTableRow) +
-                            sizeof(uint16_t) * (fRB->fSetBuilder->getNumCharCategories() - 2);
+                            sizeof(uint16_t) * (fRB->fSetBuilder->getNumCharCategories() - 1);
     table->fNumStates = fDStates->size();
     table->fFlags     = 0;
     if (fRB->fLookAheadHardBreak) {
--- source/common/ucmndata.h
+++ source/common/ucmndata.h
@@ -50,7 +50,7 @@
 
 typedef struct {
     uint32_t count;
-    UDataOffsetTOCEntry entry[2];    /* Actual size of array is from count. */
+    UDataOffsetTOCEntry entry[1];    /* Actual size of array is from count. */
 } UDataOffsetTOC;
 
 /**
--- source/common/ustring.cpp
+++ source/common/ustring.cpp
@@ -1486,7 +1486,7 @@
 */
 
 #define STRING_HASH(TYPE, STR, STRLEN, DEREF) \
-    int32_t hash = 0;                         \
+    uint32_t hash = 0;                         \
     const TYPE *p = (const TYPE*) STR;        \
     if (p != NULL) {                          \
         int32_t len = (int32_t)(STRLEN);      \
@@ -1497,7 +1497,7 @@
             p += inc;                         \
         }                                     \
     }                                         \
-    return hash
+    return static_cast<int32_t>(hash)
 
 /* Used by UnicodeString to compute its hashcode - Not public API. */
 U_CAPI int32_t U_EXPORT2