summaryrefslogtreecommitdiff
path: root/external/icu/icu4c-icu11100.patch.1
blob: 2f0e390961c1758d5823f7f08bfc94ab19be839f (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
diff -ur icu.org/source/common/ubidi.cpp icu/source/common/ubidi.cpp
--- icu.org/source/common/ubidi.cpp	2017-03-07 23:57:46.000000000 +0100
+++ icu/source/common/ubidi.cpp	2017-04-21 22:55:11.352659142 +0200
@@ -2125,6 +2125,14 @@
     return DirProp_ON;
 }
 
+static int
+isolatesavailable(UBiDi *pBiDi) {
+    if (pBiDi->isolates == pBiDi->simpleIsolates) {
+        return pBiDi->isolateCount < SIMPLE_ISOLATES_COUNT-1;
+    }
+    return pBiDi->isolateCount < pBiDi->isolatesSize/sizeof(Isolate)-1;
+}
+
 static void
 resolveImplicitLevels(UBiDi *pBiDi,
                       int32_t start, int32_t limit,
@@ -2271,7 +2279,7 @@
     /* look for the last char not a BN or LRE/RLE/LRO/RLO/PDF */
     for(i=limit-1; i>start&&(DIRPROP_FLAG(dirProps[i])&MASK_BN_EXPLICIT); i--);
     dirProp=dirProps[i];
-    if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length) {
+    if((dirProp==LRI || dirProp==RLI) && limit<pBiDi->length && isolatesavailable(pBiDi)) {
         pBiDi->isolateCount++;
         pBiDi->isolates[pBiDi->isolateCount].stateImp=stateImp;
         pBiDi->isolates[pBiDi->isolateCount].state=levState.state;