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

Caolán McNamara caolanm at redhat.com
Wed Jul 22 06:17:54 PDT 2015


 sw/qa/core/data/ww8/pass/crash-1.doc |binary
 sw/source/filter/ww8/ww8par.cxx      |   11 +++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit cbea6a709f33babfb490ab1bd07cde8cc08114ac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 22 13:51:19 2015 +0100

    xstUsrInitl contains max 9 chars
    
    Change-Id: Ia40d037d7af6cd3a283aa12948e4c5565dcb2ae6

diff --git a/sw/qa/core/data/ww8/pass/crash-1.doc b/sw/qa/core/data/ww8/pass/crash-1.doc
new file mode 100644
index 0000000..9f6b253
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/crash-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4d82b50..02d26f4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2170,15 +2170,18 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
         if (pA)
             sAuthor = *pA;
         else
-            sAuthor = OUString(pDescri->xstUsrInitl + 1, pDescri->xstUsrInitl[0],
-                RTL_TEXTENCODING_MS_1252);
+        {
+            const sal_uInt8 nLen = std::min<sal_uInt8>(pDescri->xstUsrInitl[0],
+                                                       SAL_N_ELEMENTS(pDescri->xstUsrInitl)-1);
+            sAuthor = OUString(pDescri->xstUsrInitl + 1, nLen, RTL_TEXTENCODING_MS_1252);
+        }
     }
     else
     {
         const WW8_ATRD* pDescri = static_cast<const WW8_ATRD*>(pSD->GetData());
-
         {
-            const sal_uInt16 nLen = SVBT16ToShort(pDescri->xstUsrInitl[0]);
+            const sal_uInt16 nLen = std::min<sal_uInt16>(SVBT16ToShort(pDescri->xstUsrInitl[0]),
+                                                         SAL_N_ELEMENTS(pDescri->xstUsrInitl)-1);
             OUStringBuffer aBuf;
             aBuf.setLength(nLen);
             for(sal_uInt16 nIdx = 1; nIdx <= nLen; ++nIdx)


More information about the Libreoffice-commits mailing list