summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
Diffstat (limited to 'external')
-rw-r--r--external/libexttextcat/UnpackedTarball_libexttextcat.mk3
-rw-r--r--external/libexttextcat/ubsan.patch40
2 files changed, 43 insertions, 0 deletions
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])
+ {