You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2012/10/22 18:02:14 UTC
svn commit: r1400928 -
/incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx
Author: damjan
Date: Mon Oct 22 16:02:13 2012
New Revision: 1400928
URL: http://svn.apache.org/viewvc?rev=1400928&view=rev
Log:
#i117400# CSV: importing 64Kb+ english field entry in utf-8 causes alertless crash
Patch by: Eike Rathke
Review by: Damjan Jovanovic
Modified:
incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx
Modified: incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx?rev=1400928&r1=1400927&r2=1400928&view=diff
==============================================================================
--- incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx (original)
+++ incubator/ooo/trunk/main/editeng/source/editeng/impedit2.cxx Mon Oct 22 16:02:13 2012
@@ -2765,21 +2765,24 @@ EditPaM ImpEditEngine::ImpInsertText( Ed
// Token mit LINE_SEP abfragen,
// da der MAC-Compiler aus \n etwas anderes macht!
- sal_uInt16 nStart = 0;
+ // #117400
+ // The loop run variable must be capable to hold STRLEN_MAX+1,
+ // that with STRING32 would be SAL_MAX_INT32+1 but with 16-bit is 0xFFFF+1
+ sal_uInt32 nStart = 0;
while ( nStart < aText.Len() )
{
- sal_uInt16 nEnd = aText.Search( LINE_SEP, nStart );
+ sal_uInt32 nEnd = aText.Search( LINE_SEP, static_cast<xub_StrLen>(nStart) );
if ( nEnd == STRING_NOTFOUND )
nEnd = aText.Len(); // nicht dereferenzieren!
// Start == End => Leerzeile
if ( nEnd > nStart )
{
- XubString aLine( aText, nStart, nEnd-nStart );
+ XubString aLine( aText, nStart, static_cast<xub_StrLen>(nEnd-nStart) );
xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.Len();
if ( nChars > MAXCHARSINPARA )
{
- sal_uInt16 nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len();
+ xub_StrLen nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len();
nEnd -= ( aLine.Len() - nMaxNewChars ); // Dann landen die Zeichen im naechsten Absatz.
aLine.Erase( nMaxNewChars ); // Del Rest...
}
@@ -2792,15 +2795,17 @@ EditPaM ImpEditEngine::ImpInsertText( Ed
aPaM = aEditDoc.InsertText( aPaM, aLine );
else
{
- sal_uInt16 nStart2 = 0;
+ sal_uInt32 nStart2 = 0;
while ( nStart2 < aLine.Len() )
{
- sal_uInt16 nEnd2 = aLine.Search( '\t', nStart2 );
+ sal_uInt32 nEnd2 = aLine.Search( '\t', static_cast<xub_StrLen>(nStart2) );
if ( nEnd2 == STRING_NOTFOUND )
nEnd2 = aLine.Len(); // nicht dereferenzieren!
if ( nEnd2 > nStart2 )
- aPaM = aEditDoc.InsertText( aPaM, XubString( aLine, nStart2, nEnd2-nStart2 ) );
+ aPaM = aEditDoc.InsertText( aPaM, XubString( aLine,
+ static_cast<xub_StrLen>(nStart2),
+ static_cast<xub_StrLen>(nEnd2-nStart2 ) ) );
if ( nEnd2 < aLine.Len() )
{
// aPaM = ImpInsertFeature( EditSelection( aPaM, aPaM ), );