[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - i18npool/qa i18npool/source

Caolán McNamara caolanm at redhat.com
Mon Jul 25 07:39:36 UTC 2016


 i18npool/qa/cppunit/test_breakiterator.cxx              |   16 ++++++++++++++++
 i18npool/source/breakiterator/breakiterator_unicode.cxx |    2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit e213a7cfe79f594065b6d64114749c5f49f2380c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 22 12:59:13 2016 +0100

    crashtesting: fix tdf92993-1.docx failure
    
    Change-Id: I76f09a09fd6c3b114ba74737d4a1ba5dad0fd28f
    (cherry picked from commit 5e46e382694587e88ecdebc7fa57e90fbaca7a76)
    Reviewed-on: https://gerrit.libreoffice.org/27436
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 29fc489..1c8b1f9 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -142,6 +142,22 @@ void TestBreakIterator::testLineBreaking()
             CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the line, not at ]", aResult.breakIndex == 0);
         }
     }
+
+    //this is an example sequence from tdf92993-1.docx caught by the load crashtesting
+    {
+        const sal_Unicode WEIRD1[] = { 0xd83c, 0xdf56, 0xd83c, 0xdf57, 0xd83c, 0xdf46,
+                                       0xd83c, 0xdf64, 0x2668, 0xfe0f, 0xd83c, 0xdfc6};
+
+        OUString aTest(WEIRD1, SAL_N_ELEMENTS(WEIRD1));
+
+        aLocale.Language = "en";
+        aLocale.Country = "US";
+
+        {
+            //This must not assert/crash
+            (void)m_xBreak->getLineBreak(aTest, 0, aLocale, 0, aHyphOptions, aUserOptions);
+        }
+    }
 }
 
 //See https://bugs.libreoffice.org/show_bug.cgi?id=49629
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index 91c1d35..777255c 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -423,7 +423,7 @@ LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak(
         GlueSpace=false;
         if (lbr.breakType == BreakType::WORDBOUNDARY) {
             nStartPos = lbr.breakIndex;
-            if (Text[nStartPos--] == WJ)
+            if (nStartPos >= 0 && Text[nStartPos--] == WJ)
                 GlueSpace=true;
             while (nStartPos >= 0 &&
                     (u_isWhitespace(Text.iterateCodePoints(&nStartPos, 0)) || Text[nStartPos] == WJ)) {


More information about the Libreoffice-commits mailing list