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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 18 08:43:20 UTC 2020


 external/icu/ubsan.patch.1 |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

New commits:
commit 904fb08b1ee9a632bbacd80439ef5919468c9464
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Nov 18 07:36:06 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Nov 18 09:42:38 2020 +0100

    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 at redhat.com>

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


More information about the Libreoffice-commits mailing list