i18npool/qa/cppunit/test_breakiterator.cxx | 16 ++++++++++++++++ i18npool/source/breakiterator/breakiterator_unicode.cxx | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit d3f3183feeef23c8a65c2fc78a65fd5bff5df41e Author: Caolán McNamara <caol...@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/27435 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@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 8707dd45..117b0ba 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)) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits