summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-22 14:33:00 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-22 14:33:32 +0200
commit60c43d81ad4fa2ee587527d18522ac34148af2f2 (patch)
treebf8f672312ab5c748193abb0b569a0c59346a73a /external
parent77ad60af119ab23a0bfadb3e5a0c4433fe97835b (diff)
Some trivial fix for hash function signed overflow undefined behavior
Change-Id: I41ec24a02867ba3c5bf4f39b5d79bf6a3254ad0d
Diffstat (limited to 'external')
-rw-r--r--external/icu/UnpackedTarball_icu.mk1
-rw-r--r--external/icu/icu-ubsan.patch.020
2 files changed, 21 insertions, 0 deletions
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 77cd38a8bb1f..3b06d22b5104 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/icu-ubsan.patch.0 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/icu/icu-ubsan.patch.0 b/external/icu/icu-ubsan.patch.0
new file mode 100644
index 000000000000..ef3121f88299
--- /dev/null
+++ b/external/icu/icu-ubsan.patch.0
@@ -0,0 +1,20 @@
+--- 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