diff options
author | Eike Rathke <erack@redhat.com> | 2013-12-05 20:28:29 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-12-05 20:32:31 +0100 |
commit | 6f2c7baccd4835508582abc429ca70c3e12a7496 (patch) | |
tree | 5d0762ff548e57fadf12e654b3184ec5913f865b | |
parent | b4da3c26521b5b20a792c1913ee26ff846d166f0 (diff) |
fixed out of bounds string access
Change-Id: I25f53f16c3ddc3456c165b6c604911433f460228
(cherry picked from commit 40fba2316ac3ebb11b69c157cfac7da92a63821b)
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8001e678489d..f0f6cf8df86f 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1249,11 +1249,15 @@ static void lcl_CompleteFunction( EditView* pView, const OUString& rInsert, bool ESelection aWordSel = pView->GetSelection(); OUString aOld = pView->GetEditEngine()->GetText(0); - sal_Unicode cNext = aOld[aWordSel.nEndPos]; - if ( cNext == '(' ) + // aWordSel.EndPos points one behind string if word at end. + if (aWordSel.nEndPos < aOld.getLength()) { - bDoParen = false; - aInsStr = aInsStr.copy( 0, nInsLen - 2 ); // Klammern weglassen + sal_Unicode cNext = aOld[aWordSel.nEndPos]; + if ( cNext == '(' ) + { + bDoParen = false; + aInsStr = aInsStr.copy( 0, nInsLen - 2 ); // Klammern weglassen + } } } |