[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 2 19:19:11 UTC 2020


 sw/source/filter/ascii/parasc.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 098ca4e0f1e09d10cbd038ffdec75bbc9c6d133d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 2 14:43:53 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 2 21:18:27 2020 +0200

    crashtesting: an odd number of bytes for RTL_TEXTENCODING_UCS2 encoding
    
    seen with id:000316,src:000190+000204,op:splice,rep:32.doc
    
    Change-Id: Ia4eb13ed617828f0d35bed26651a7b9e9a4b6056
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103860
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index a2d7bbe30508..73536d36213e 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -348,12 +348,13 @@ ErrCode SwASCIIParser::ReadChars()
             else
             {
                 pStt = pLastStt = reinterpret_cast<sal_Unicode*>(pArr.get());
-                pEnd = reinterpret_cast<sal_Unicode*>(pArr.get() + lGCount);
+                auto nChars = lGCount / 2;
+                pEnd = pStt + nChars;
 
                 if( bSwapUnicode )
                 {
                     char* pF = pArr.get(), *pN = pArr.get() + 1;
-                    for( sal_uLong n = 0; n < lGCount; n += 2, pF += 2, pN += 2 )
+                    for( sal_uLong n = 0; n < nChars; ++n, pF += 2, pN += 2 )
                     {
                         char c = *pF;
                         *pF = *pN;


More information about the Libreoffice-commits mailing list