[Libreoffice-commits] core.git: external/libexttextcat

Stephan Bergmann sbergman at redhat.com
Tue Sep 19 14:15:33 UTC 2017


 external/libexttextcat/UnpackedTarball_libexttextcat.mk |    3 +
 external/libexttextcat/ubsan.patch                      |   40 ++++++++++++++++
 2 files changed, 43 insertions(+)

New commits:
commit 67141d8331f9cb85751a4747986774b53b7f4a77
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 19 16:14:05 2017 +0200

    external/libexttextcat: Silence various -fsanitize=shift-base
    
    ...during 'instdir/program/soffice
    writerfilter/qa/cppunittests/rtftok/data/pass/EDB-18940-1.rtf'
    
    Change-Id: Icd5eb7b1f574e95b48b9d2fcb97d4157404dda13

diff --git a/external/libexttextcat/UnpackedTarball_libexttextcat.mk b/external/libexttextcat/UnpackedTarball_libexttextcat.mk
index 6b590f2fdf21..4009da04a01b 100644
--- a/external/libexttextcat/UnpackedTarball_libexttextcat.mk
+++ b/external/libexttextcat/UnpackedTarball_libexttextcat.mk
@@ -9,8 +9,11 @@
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,libexttextcat))
 
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libexttextcat,0))
+
 $(eval $(call gb_UnpackedTarball_add_patches,libexttextcat,\
         external/libexttextcat/exttextcat-iOS.patch.1 \
+        external/libexttextcat/ubsan.patch \
 ))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,libexttextcat,$(LIBEXTTEXTCAT_TARBALL)))
diff --git a/external/libexttextcat/ubsan.patch b/external/libexttextcat/ubsan.patch
new file mode 100644
index 000000000000..767a9a003619
--- /dev/null
+++ b/external/libexttextcat/ubsan.patch
@@ -0,0 +1,40 @@
+--- src/fingerprint.c
++++ src/fingerprint.c
+@@ -128,7 +128,7 @@
+  */
+ static uint4 simplehash(const char *p, int len)
+ {
+-    sint4 h = len * 13;
++    uint4 h = len * 13;
+     while (*p)
+     {
+         h = (h << 5) - h + *p++;
+--- src/utf8misc.c
++++ src/utf8misc.c
+@@ -61,7 +61,7 @@
+          * if the first bit of the current char is 1 then *str is an escape
+          * character
+          */
+-        char escape_char = ((*str & WEIGHT_MASK) << 1);
++        unsigned char escape_char = ((*str & WEIGHT_MASK) << 1);
+ 
+         /* 
+          * and we use it to count (by bit translation) following characters
+@@ -99,7 +99,7 @@
+          * then str[pointer] is an escape character and we use it to count
+          * following characters (only the weightest part)
+          */
+-        char escape_char = ((str[pointer] & WEIGHT_MASK) << 1);
++        unsigned char escape_char = ((str[pointer] & WEIGHT_MASK) << 1);
+ 
+         /* 
+          * every step, we move the byte of 1 bit left, when first bit is 0,
+@@ -138,7 +138,7 @@
+              * (only the weightest part)
+              */
+ 
+-            char escape_char = ((key[pointer] & WEIGHT_MASK) << 1);
++            unsigned char escape_char = ((key[pointer] & WEIGHT_MASK) << 1);
+ 
+             while (escape_char & ESCAPE_MASK && key[pointer] == lex[pointer])
+             {


More information about the Libreoffice-commits mailing list