i18npool/source/breakiterator/breakiterator_cjk.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0ea06dd96c513e3daa881896679507189aeb2034
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Jul 29 13:33:53 2019 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Jul 31 09:18:23 2019 +0200

    Avoid out-of-bounds string access
    
    ...as happens when loading doc/ooo112635-1.doc (i.e., attachment
    justified_chinese_paragraph_issue.doc at
    <https://bz.apache.org/ooo/show_bug.cgi?id=112635#c1>):
    
    > soffice.bin: /home/sbergman/lo/core/include/rtl/ustring.hxx:689: 
sal_Unicode rtl::OUString::operator[](sal_Int32) const: Assertion `index >= 0 
&& static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())' 
failed.
    
    > #4  0x00007fff80397994 in rtl::OUString::operator[](int) const 
(this=0x61400027fdc0, index=68) at 
/home/sbergman/lo/core/include/rtl/ustring.hxx:689
    > #5  0x00007fff80393283 in 
i18npool::BreakIterator_CJK::getLineBreak(rtl::OUString const&, int, 
com::sun::star::lang::Locale const&, int, 
com::sun::star::i18n::LineBreakHyphenationOptions const&, 
com::sun::star::i18n::LineBreakUserOptions const&) (this=0x613000281480, Text=" 
   本篇即在于指出十二宫反应的一些重点。学者若能参考上篇《星曜论》所言的星曜性质,当别有会心之处。因为事实上没有可能将一切星曜组合的", 
nStartPos=68, bOptions=...) at 
/home/sbergman/lo/core/i18npool/source/breakiterator/breakiterator_cjk.cxx:109
    > #6  0x00007fff803942fa in non-virtual thunk to 
i18npool::BreakIterator_CJK::getLineBreak(rtl::OUString const&, int, 
com::sun::star::lang::Locale const&, int, 
com::sun::star::i18n::LineBreakHyphenationOptions const&, 
com::sun::star::i18n::LineBreakUserOptions const&) () at 
/home/sbergman/lo/core/instdir/program/../program/libi18npoollo.so
    > #7  0x00007fff803aed0f in 
i18npool::BreakIteratorImpl::getLineBreak(rtl::OUString const&, int, 
com::sun::star::lang::Locale const&, int, 
com::sun::star::i18n::LineBreakHyphenationOptions const&, 
com::sun::star::i18n::LineBreakUserOptions const&) (this=0x60e0004163e0, Text=" 
   本篇即在于指出十二宫反应的一些重点。学者若能参考上篇《星曜论》所言的星曜性质,当别有会心之处。因为事实上没有可能将一切星曜组合的", 
nStartPos=68, rLocale=..., nMinBreakPos=35, hOptions=..., bOptions=...) at 
/home/sbergman/lo/core/i18npool/source/breakiterator/breakiteratorImpl.cxx:243
    > #8  0x00007fff803aeeca in non-virtual thunk to 
i18npool::BreakIteratorImpl::getLineBreak(rtl::OUString const&, int, 
com::sun::star::lang::Locale const&, int, 
com::sun::star::i18n::LineBreakHyphenationOptions const&, 
com::sun::star::i18n::LineBreakUserOptions const&) () at 
/home/sbergman/lo/core/instdir/program/../program/libi18npoollo.so
    > #9  0x00007fff4d209e09 in SwTextGuess::Guess(SwTextPortion const&, 
SwTextFormatInfo&, unsigned short) (this=0x7fff9ae398c0, rPor=..., rInf=..., 
nPorHeight=304) at /home/sbergman/lo/core/sw/source/core/text/guess.cxx:407
    > #10 0x00007fff4d5be607 in SwTextPortion::Format_(SwTextFormatInfo&) 
(this=0x604000a2f950, rInf=...) at 
/home/sbergman/lo/core/sw/source/core/text/portxt.cxx:310
    [...]
    
    Change-Id: I51d4bbecce4e929752a9f561f72acef446be21cb
    Reviewed-on: https://gerrit.libreoffice.org/76550
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx 
b/i18npool/source/breakiterator/breakiterator_cjk.cxx
index 3854ce2ca628..2049f3b47f73 100644
--- a/i18npool/source/breakiterator/breakiterator_cjk.cxx
+++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx
@@ -106,6 +106,7 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak(
     const sal_Int32 nOldStartPos = nStartPos;
 
     if (bOptions.allowPunctuationOutsideMargin &&
+            nStartPos != Text.getLength() &&
             hangingCharacters.indexOf(Text[nStartPos]) != -1 &&
             (Text.iterateCodePoints( &nStartPos ), nStartPos == 
Text.getLength())) {
         ; // do nothing
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to