summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-31 22:06:15 +0200
committerMichael Stahl <mstahl@redhat.com>2014-09-09 20:30:19 +0000
commit2ce8b2c37aaebacdce250d6758d93ce7f9a992f0 (patch)
treed38225382b97bcc2795ab79e7308c3f6a1ff8831 /editeng
parent0d0920b13e23763ba2cc72eb48729ad2fad9d23d (diff)
editeng: avoid autocorrect crash
Happened for me with nFndPos = 30 and nEndPos = 20, and a rTxt that probably contained "->" twice. Change-Id: I534c60a5904249e25fdefe45639b4512e6f138c5 Reviewed-on: https://gerrit.libreoffice.org/11344 Reviewed-by: Németh László <nemeth@numbertext.org> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 04e079be92a7..f22cb42d871f 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2833,6 +2833,10 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
;
if (bWasWordDelim) nFndPos++;
}
+ if (nEndPos + extra_repl <= nFndPos)
+ {
+ return 0;
+ }
// store matching pattern and its replacement as a new list item, eg. "i18ns" -> "internationalizations"
OUString aShort = rTxt.copy(nFndPos, nEndPos - nFndPos + extra_repl);