From a3d187bfde40bb048767d162b849b3f723ffbd69 Mon Sep 17 00:00:00 2001
From: Jens-Heiner Rechtien
Date: Mon, 16 Jun 2003 10:35:22 +0000
Subject: INTEGRATION: CWS rcregression01 (1.10.10); FILE MERGED 2003/06/12
10:59:15 ssa 1.10.10.1: #110212#,#110219# check nIndex before accessing rKey
---
vcl/source/window/mnemonic.cxx | 41 +++++++++++++++++++++++++----------------
1 file changed, 25 insertions(+), 16 deletions(-)
(limited to 'vcl/source/window/mnemonic.cxx')
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index 14310febeb6d..2f55578ed328 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mnemonic.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: vg $ $Date: 2003-06-04 11:22:56 $
+ * last change: $Author: hr $ $Date: 2003-06-16 11:35:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -308,20 +308,29 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey )
aStr += c;
aStr += ')';
nIndex = rKey.Len();
- static sal_Unicode cGreaterGreater[] = { 0xFF1E, 0xFF1E };
- if ( rKey.EqualsAscii( ">>", nIndex-2, 2 ) ||
- rKey.Equals( cGreaterGreater, nIndex-2, 2 ) )
- nIndex -= 2;
- static sal_Unicode cDotDotDot[] = { 0xFF0E, 0xFF0E, 0xFF0E };
- if ( rKey.EqualsAscii( "...", nIndex-3, 3 ) ||
- rKey.Equals( cDotDotDot, nIndex-3, 3 ) )
- nIndex -= 3;
- sal_Unicode cLastChar = rKey.GetChar( nIndex-1 );
- if ( (cLastChar == ':') || (cLastChar == 0xFF1A) ||
- (cLastChar == '.') || (cLastChar == 0xFF0E) ||
- (cLastChar == '?') || (cLastChar == 0xFF1F) ||
- (cLastChar == ' ') )
- nIndex--;
+ if( nIndex >= 2 )
+ {
+ static sal_Unicode cGreaterGreater[] = { 0xFF1E, 0xFF1E };
+ if ( rKey.EqualsAscii( ">>", nIndex-2, 2 ) ||
+ rKey.Equals( cGreaterGreater, nIndex-2, 2 ) )
+ nIndex -= 2;
+ }
+ if( nIndex >= 3 )
+ {
+ static sal_Unicode cDotDotDot[] = { 0xFF0E, 0xFF0E, 0xFF0E };
+ if ( rKey.EqualsAscii( "...", nIndex-3, 3 ) ||
+ rKey.Equals( cDotDotDot, nIndex-3, 3 ) )
+ nIndex -= 3;
+ }
+ if( nIndex >= 1)
+ {
+ sal_Unicode cLastChar = rKey.GetChar( nIndex-1 );
+ if ( (cLastChar == ':') || (cLastChar == 0xFF1A) ||
+ (cLastChar == '.') || (cLastChar == 0xFF0E) ||
+ (cLastChar == '?') || (cLastChar == 0xFF1F) ||
+ (cLastChar == ' ') )
+ nIndex--;
+ }
rKey.Insert( aStr, nIndex );
bChanged = TRUE;
break;
--
cgit