[Libreoffice-commits] core.git: editeng/source

László Németh laszlo.nemeth at collabora.com
Sat May 21 00:54:58 UTC 2016


 editeng/source/misc/svxacorr.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 785e530e836e98a58c51fd8cc19ba6871cd89769
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Sat May 21 02:26:48 2016 +0200

    fix bad index/assertion failure with line ending autocorrect patterns
    
    Test case: type "->" and press Enter in a new en-US text document.
    Result: crash or missing replacement of the arrow.
    
    Change-Id: I052ae868b6fe0b1e5557c40471d31a20bd1e5ca9

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index de42542..5545432 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2834,8 +2834,11 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
                 SvxAutocorrWord* pNew = new SvxAutocorrWord(aShort, aLong);
                 if ( Insert( pNew ) )
                 {
-                    if ( IsWordDelim(rTxt[nEndPos]) ) return pNew;
-                } else delete pNew;
+                    if ( (rTxt.getLength() > nEndPos && IsWordDelim(rTxt[nEndPos])) || rTxt.getLength() == nEndPos )
+                        return pNew;
+                }
+                else
+                    delete pNew;
             }
         }
     }


More information about the Libreoffice-commits mailing list