[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-8' - external/icu

Caolán McNamara caolanm at redhat.com
Wed Dec 3 07:31:08 PST 2014


 external/icu/UnpackedTarball_icu.mk |    1 
 external/icu/icu4c-scriptrun.patch  |   58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)

New commits:
commit 8594604107f1727303f57294c4c8c8a8dc5d2265
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Nov 30 20:38:42 2014 +0000

    mirror fixes for fdo#78906 and deb#766788 into icu
    
    (cherry picked from commit a66451887425ddd9387e2b25d5125916f4a35f83)
    (cherry picked from commit bff0fe902686d8c126a73e1d2c914f5d65c6ffaf)
    
    Conflicts:
    	external/icu/UnpackedTarball_icu.mk
    
    Change-Id: I9325bb28eb267b023f628e24fea216ad580759e9
    (cherry picked from commit c0d9f573b1200f8860f1c1c89107d54226869f56)
    Reviewed-on: https://gerrit.libreoffice.org/13242
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 77cd38a..8c73b48 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
 	external/icu/icu4c-mkdir.patch \
 	external/icu/icu4c-buffer-overflow.patch \
 	external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch \
+	external/icu/icu4c-scriptrun.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/icu/icu4c-scriptrun.patch b/external/icu/icu4c-scriptrun.patch
new file mode 100644
index 0000000..e307811
--- /dev/null
+++ b/external/icu/icu4c-scriptrun.patch
@@ -0,0 +1,58 @@
+--- misc/icu/source/extra/scrptrun/scrptrun.cpp
++++ misc/build/icu/source/extra/scrptrun/scrptrun.cpp
+@@ -150,7 +150,11 @@
+         // characters above it on the stack will be poped.
+         if (pairIndex >= 0) {
+             if ((pairIndex & 1) == 0) {
+-                parenStack[++parenSP].pairIndex = pairIndex;
++                ++parenSP;
++                int32_t nVecSize = parenStack.size();
++                if (parenSP == nVecSize)
++                    parenStack.resize(nVecSize + 128);
++                parenStack[parenSP].pairIndex = pairIndex;
+                 parenStack[parenSP].scriptCode  = scriptCode;
+             } else if (parenSP >= 0) {
+                 int32_t pi = pairIndex & ~1;
+@@ -184,7 +188,14 @@
+             // pop it from the stack
+             if (pairIndex >= 0 && (pairIndex & 1) != 0 && parenSP >= 0) {
+                 parenSP -= 1;
+-                startSP -= 1;
++                /* decrement startSP only if it is >= 0,
++                   decrementing it unnecessarily will lead to memory corruption
++                   while processing the above while block.
++                   e.g. startSP = -4 , parenSP = -1
++                */
++                if (startSP >= 0) {
++                    startSP -= 1;
++                }
+             }
+         } else {
+             // if the run broke on a surrogate pair,
+--- misc/icu/source/extra/scrptrun/scrptrun.h
++++ misc/build/icu/source/extra/scrptrun/scrptrun.h
+@@ -17,6 +17,7 @@
+ #include "unicode/utypes.h"
+ #include "unicode/uobject.h"
+ #include "unicode/uscript.h"
++#include <vector>
+ 
+ struct ScriptRecord
+ {
+@@ -79,7 +80,7 @@
+     int32_t scriptEnd;
+     UScriptCode scriptCode;
+ 
+-    ParenStackEntry parenStack[128];
++    std::vector<ParenStackEntry> parenStack;
+     int32_t parenSP;
+ 
+     static int8_t highBit(int32_t value);
+@@ -133,6 +134,7 @@
+     scriptEnd   = charStart;
+     scriptCode  = USCRIPT_INVALID_CODE;
+     parenSP     = -1;
++    parenStack.resize(128);
+ }
+ 
+ inline void ScriptRun::reset(int32_t start, int32_t length)


More information about the Libreoffice-commits mailing list