sw/source/filter/ww8/WW8Sttbf.cxx |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 4c68c4b93c41c4e9c2d5faf6c02ece2d40e95eb4
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Mar 1 08:23:31 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Mar 1 10:30:09 2022 +0100

    misaligned-pointer-use
    
    ...during CppunitTest_sw_filters_test,
    
    
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/bits/stl_algobase.h:385:20:
 runtime error: load of misaligned address 0x61d001aedef7 for type 'const 
char16_t', which requires 2 byte alignment
    0x61d001aedef7: note: pointer points here
     01 00 00 00 ff  00 00 00 00 00 00 00 00  be be be be be be be be  be be be 
be be be be be  be be be
                 ^
     #0 in char16_t* std::__copy_move<false, false, 
std::random_access_iterator_tag>::__copy_m<char16_t const*, char16_t*>(char16_t 
const*, char16_t const*, char16_t*) at 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/bits/stl_algobase.h:385:20
     #1 in char16_t* std::__copy_move_a2<false, char16_t const*, 
char16_t*>(char16_t const*, char16_t const*, char16_t*) at 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/bits/stl_algobase.h:491:9
     #2 in char16_t* std::__copy_move_a1<false, char16_t const*, 
char16_t*>(char16_t const*, char16_t const*, char16_t*) at 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/bits/stl_algobase.h:522:14
     #3 in char16_t* std::__copy_move_a<false, char16_t const*, 
char16_t*>(char16_t const*, char16_t const*, char16_t*) at 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/bits/stl_algobase.h:530:3
     #4 in char16_t* std::copy<char16_t const*, char16_t*>(char16_t const*, 
char16_t const*, char16_t*) at 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/bits/stl_algobase.h:619:14
     #5 in void rtl::str::Copy<char16_t>(char16_t*, char16_t const*, int) at 
sal/rtl/strtmpl.hxx:50:5
     #6 in void rtl::str::newFromStr_WithLength<_rtl_uString, 
char16_t>(_rtl_uString**, char16_t const*, int, int) at 
sal/rtl/strtmpl.hxx:1054:9
     #7 in rtl_uString_newFromStr_WithLength at sal/rtl/ustring.cxx:1246:5
     #8 in rtl::OUString::OUString(char16_t const*, int) at 
include/rtl/ustring.hxx:332:9
     #9 in ww8::WW8Struct::getUString(unsigned int, unsigned int) at 
sw/source/filter/ww8/WW8Sttbf.cxx:87:23
    
    presumably since 22de5757a2c7c6cd4544a4699e5d4c69969f5961 "Deduplicate 
string
    buffer code" changed the Copy function template in sal/rtl/strtmpl.hxx from
    using memcpy to using std::copy.
    
    (And this revealed that the !OSL_LITENDIAN code had apparently started to 
rot
    and lacked #include <rtl/ustrbuf.hxx>.)
    
    Change-Id: I3e2c5578c6ca18c8880c6d6b6afd191a91da268d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130739
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sw/source/filter/ww8/WW8Sttbf.cxx 
b/sw/source/filter/ww8/WW8Sttbf.cxx
index 1e23c8ca89a7..2739f208d902 100644
--- a/sw/source/filter/ww8/WW8Sttbf.cxx
+++ b/sw/source/filter/ww8/WW8Sttbf.cxx
@@ -24,6 +24,7 @@
 #include "WW8Sttbf.hxx"
 #include <osl/endian.h>
 #include <o3tl/make_shared.hxx>
+#include <rtl/ustrbuf.hxx>
 #include <tools/stream.hxx>
 #include <sal/log.hxx>
 #include <osl/diagnose.h>
@@ -83,15 +84,10 @@ namespace ww8
             sal_uInt32 nAvailable = (mn_size - nStartOff)/sizeof(sal_Unicode);
             if (nCount > nAvailable)
                 nCount = nAvailable;
-#if defined OSL_LITENDIAN
-            aResult = OUString(reinterpret_cast<const sal_Unicode *>(
-                m_pData.get() + nStartOff), nCount);
-#else
             OUStringBuffer aBuf;
             for (sal_uInt32 i = 0; i < nCount; ++i)
                 aBuf.append(static_cast<sal_Unicode>(getU16(nStartOff+i*2)));
             aResult = aBuf.makeStringAndClear();
-#endif
         }
 
         SAL_INFO( "sw.ww8.level2", "<WW8Struct-getUString offset=\"" << nOffset

Reply via email to