Kaydet (Commit) 9bb1b4c5 authored tarafından Caolán McNamara's avatar Caolán McNamara

don't access string out of bounds

Change-Id: I1cee53bc864efaa4ae3b4462111cad4dc80e82be
üst 8001d9f4
...@@ -642,11 +642,16 @@ sal_Bool SvxAutoCorrect::FnAddNonBrkSpace( ...@@ -642,11 +642,16 @@ sal_Bool SvxAutoCorrect::FnAddNonBrkSpace(
while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ]))) while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ])))
; ;
if(INetURLObject::CompareProtocolScheme(rTxt.copy(nSttWdPos + (bWasWordDelim ? 1 : 0), nEndPos - nSttWdPos + 1)) != INET_PROT_NOT_VALID) { //See if the text is the start of a protocol string, e.g. have text of
return sal_False; //"http" see if it is the start of "http:" and if so leave it alone
sal_Int32 nIndex = nSttWdPos + (bWasWordDelim ? 1 : 0);
sal_Int32 nProtocolLen = nEndPos - nSttWdPos + 1;
if (nIndex + nProtocolLen <= rTxt.getLength())
{
if (INetURLObject::CompareProtocolScheme(rTxt.copy(nIndex, nProtocolLen)) != INET_PROT_NOT_VALID)
return sal_False;
} }
// Check the presence of "://" in the word // Check the presence of "://" in the word
xub_StrLen nStrPos = rTxt.indexOf( "://", nSttWdPos + 1 ); xub_StrLen nStrPos = rTxt.indexOf( "://", nSttWdPos + 1 );
if ( STRING_NOTFOUND == nStrPos && nEndPos > 0 ) if ( STRING_NOTFOUND == nStrPos && nEndPos > 0 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment