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:30:14 +0100 |
commit | 40fba2316ac3ebb11b69c157cfac7da92a63821b (patch) | |
tree | 657edf2d2e4d0236126262da71f699fcecab6b29 /sc | |
parent | 689bcd929fbc3b9cd28193e4a171fbe16cad8c01 (diff) |
fixed out of bounds string access
Change-Id: I25f53f16c3ddc3456c165b6c604911433f460228
Diffstat (limited to 'sc')
-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 00bcf3cb48cc..08996c469175 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1247,11 +1247,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 + } } } |