summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-11-18 07:36:06 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-11-18 09:42:38 +0100
commit904fb08b1ee9a632bbacd80439ef5919468c9464 (patch)
treefb2d0b6b75e387d49e88051fa28d1a7769ee2c05 /external
parent388b624dde64fd6c86f15b21f8ac3e42ce9a9db5 (diff)
external/icu: Silence UBSan misaligned-pointer-use
...seen when e.g. building CustomTarget/i18npool/breakiterator/char_in.brk: > rbbitblb.cpp:1405:18: runtime error: member access within misaligned address 0x627000026987 for type 'icu_68::RBBIStateTableRow', which requires 2 byte alignment > 0x627000026987: note: pointer points here > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > ^ and > rbbitblb.cpp:1607:18: runtime error: member access within misaligned address 0x627000026ecf for type 'icu_68::RBBIStateTableRow', which requires 2 byte alignment > 0x627000026ecf: note: pointer points here > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > ^ (i.e., even though those code branches only access the byte-sized RBBIStateTableRow8 data, they did so through a RBBIStateTableRow union pointer, which has stronger alignment requirements) Change-Id: I0abe5bd756758e33e495538f548e80f99460f43c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106038 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/icu/ubsan.patch.138
1 files changed, 38 insertions, 0 deletions
diff --git a/external/icu/ubsan.patch.1 b/external/icu/ubsan.patch.1
index 1c10f8cefcc2..1d7006347bd3 100644
--- a/external/icu/ubsan.patch.1
+++ b/external/icu/ubsan.patch.1
@@ -1,3 +1,41 @@
+--- a/source/common/rbbitblb.cpp
++++ a/source/common/rbbitblb.cpp
+@@ -1402,12 +1402,13 @@
+ U_ASSERT (sd->fAccepting <= 255);
+ U_ASSERT (sd->fLookAhead <= 255);
+ U_ASSERT (0 <= sd->fTagsIdx && sd->fTagsIdx <= 255);
+- row->r8.fAccepting = sd->fAccepting;
+- row->r8.fLookAhead = sd->fLookAhead;
+- row->r8.fTagsIdx = sd->fTagsIdx;
++ RBBIStateTableRow8 *row8 = reinterpret_cast<RBBIStateTableRow8 *>(row);
++ row8->fAccepting = sd->fAccepting;
++ row8->fLookAhead = sd->fLookAhead;
++ row8->fTagsIdx = sd->fTagsIdx;
+ for (col=0; col<catCount; col++) {
+ U_ASSERT (sd->fDtran->elementAti(col) <= kMaxStateFor8BitsTable);
+- row->r8.fNextState[col] = sd->fDtran->elementAti(col);
++ row8->fNextState[col] = sd->fDtran->elementAti(col);
+ }
+ } else {
+ U_ASSERT (sd->fAccepting <= 0xffff);
+@@ -1603,12 +1603,13 @@
+ UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(state);
+ RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen);
+ if (use8BitsForSafeTable()) {
+- row->r8.fAccepting = 0;
+- row->r8.fLookAhead = 0;
+- row->r8.fTagsIdx = 0;
++ RBBIStateTableRow8 *row8 = reinterpret_cast<RBBIStateTableRow8 *>(row);
++ row8->fAccepting = 0;
++ row8->fLookAhead = 0;
++ row8->fTagsIdx = 0;
+ for (col=0; col<catCount; col++) {
+ U_ASSERT(rowString->charAt(col) <= kMaxStateFor8BitsTable);
+- row->r8.fNextState[col] = static_cast<uint8_t>(rowString->charAt(col));
++ row8->fNextState[col] = static_cast<uint8_t>(rowString->charAt(col));
+ }
+ } else {
+ row->r16.fAccepting = 0;
diff -ur icu.org/source/tools/genrb/rbutil.c icu/source/tools/genrb/rbutil.c
--- icu.org/source/tools/genrb/rbutil.c 2020-10-28 22:21:12.000000000 +0100
+++ icu/source/tools/genrb/rbutil.c 2020-11-16 19:50:44.005119253 +0100