summaryrefslogtreecommitdiff
path: root/external/hunspell
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-13 12:31:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-13 12:32:06 +0100
commit4cd1c4cb41316e16996a92695d86ac1d956d7e07 (patch)
tree524a51c146255d90a3b61b4bd23adb395926832b /external/hunspell
parent2813632238380e0bfe40c0e6404a07102cde1398 (diff)
external/hunspell: Work around -fsanitize=shift
Change-Id: I66ac6ec25615698382d065db2b782950cbc154e4
Diffstat (limited to 'external/hunspell')
-rw-r--r--external/hunspell/ubsan.patch.024
1 files changed, 24 insertions, 0 deletions
diff --git a/external/hunspell/ubsan.patch.0 b/external/hunspell/ubsan.patch.0
index 8749cd91e645..b52802d209f4 100644
--- a/external/hunspell/ubsan.patch.0
+++ b/external/hunspell/ubsan.patch.0
@@ -9,3 +9,27 @@
for (int i=0; i < 4 && *word != 0; i++)
hv = (hv << 8) | (*word++);
while (*word != 0) {
+--- src/hunspell/csutil.cxx
++++ src/hunspell/csutil.cxx
+@@ -147,7 +147,7 @@
+ case 0xd0: { // 2-byte UTF-8 codes
+ if ((*(u8+1) & 0xc0) == 0x80) {
+ u2->h = (*u8 & 0x1f) >> 2;
+- u2->l = (*u8 << 6) + (*(u8+1) & 0x3f);
++ u2->l = (*reinterpret_cast<unsigned char const *>(u8) << 6) + (*(u8+1) & 0x3f);
+ u8++;
+ } else {
+ HUNSPELL_WARNING(stderr, "UTF-8 encoding error. Missing continuation byte in %ld. character position:\n%s\n", static_cast<long>(u8 - (signed char *)src), src);
+@@ -158,10 +158,10 @@
+ }
+ case 0xe0: { // 3-byte UTF-8 codes
+ if ((*(u8+1) & 0xc0) == 0x80) {
+- u2->h = ((*u8 & 0x0f) << 4) + ((*(u8+1) & 0x3f) >> 2);
++ u2->h = ((*reinterpret_cast<unsigned char const *>(u8) & 0x0f) << 4) + ((*(u8+1) & 0x3f) >> 2);
+ u8++;
+ if ((*(u8+1) & 0xc0) == 0x80) {
+- u2->l = (*u8 << 6) + (*(u8+1) & 0x3f);
++ u2->l = (*reinterpret_cast<unsigned char const *>(u8) << 6) + (*(u8+1) & 0x3f);
+ u8++;
+ } else {
+ HUNSPELL_WARNING(stderr, "UTF-8 encoding error. Missing continuation byte in %ld. character position:\n%s\n", static_cast<long>(u8 - (signed char *)src), src);