i18npool/source/search/textsearch.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 25e7318a294c5613a9a2361e0e1cebd5c214d336
Author: Matthew J. Francis <mjay.fran...@gmail.com>
Date:   Tue Oct 7 01:51:37 2014 +0800

    Avoid accessing 1 character after a string
    
    Found while trying to reproduce fdo#83141, but not related to
    that - it just happened to trigger the relevant assert on a dbgutil
    build.
    
    The change to TextSearch::NSrchFrwrd() fixes the crash triggered
    by reproducing the above bug.
    The change to TextSearch::NSrchBkwrd() is by analogy but seems an
    equally good idea.
    
    Change-Id: I68c2c87b632dd53453f92394519a06f62e41bbad
    Reviewed-on: https://gerrit.libreoffice.org/11830
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>
    (cherry picked from commit 555a7a601b33c18472be7e99b0f9c8acb05a82d7)
    Reviewed-on: https://gerrit.libreoffice.org/11846

diff --git a/i18npool/source/search/textsearch.cxx 
b/i18npool/source/search/textsearch.cxx
index d95600d..e2d424f 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -615,7 +615,7 @@ SearchResult TextSearch::NSrchFrwrd( const OUString& 
searchStr, sal_Int32 startP
                     bool bAtStart = !nCmpIdx;
                     bool bAtEnd = nFndEnd == endPos;
                     bool bDelimBefore = bAtStart || IsDelimiter( aStr, 
nCmpIdx-1 );
-                    bool bDelimBehind = IsDelimiter(  aStr, nFndEnd );
+                    bool bDelimBehind = bAtEnd || IsDelimiter(  aStr, nFndEnd 
);
                     //  *       1 -> only one word in the paragraph
                     //  *       2 -> at begin of paragraph
                     //  *       3 -> at end of paragraph
@@ -686,7 +686,7 @@ SearchResult TextSearch::NSrchBkwrd( const OUString& 
searchStr, sal_Int32 startP
                     sal_Int32 nFndStt = nCmpIdx - sSearchKey.getLength();
                     bool bAtStart = !nFndStt;
                     bool bAtEnd = nCmpIdx == startPos;
-                    bool bDelimBehind = IsDelimiter( aStr, nCmpIdx );
+                    bool bDelimBehind = bAtEnd || IsDelimiter( aStr, nCmpIdx );
                     bool bDelimBefore = bAtStart || // begin of paragraph
                         IsDelimiter( aStr, nFndStt-1 );
                     //  *       1 -> only one word in the paragraph
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to