sc/source/core/tool/compiler.cxx | 4 ++-- sc/source/ui/app/inputhdl.cxx | 14 +++++++++----- sc/source/ui/view/viewdata.cxx | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-)
New commits: commit 082e1fa44cf6b3d61d571bab99407d3f38d8288d Author: Caolán McNamara <caol...@redhat.com> Date: Thu Oct 24 13:51:09 2013 +0100 more string bounds checks for sc Change-Id: I99293a91018c130415bd3816fa23f44643512a74 diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 33ba889..5a7d8e2 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3673,14 +3673,14 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula ) aCorrectedSymbol = ""; } sal_uInt8 nForced = 0; // ==formula forces recalc even if cell is not visible - if( aFormula[nSrcPos] == '=' ) + if( nSrcPos < aFormula.getLength() && aFormula[nSrcPos] == '=' ) { nSrcPos++; nForced++; if ( bAutoCorrect ) aCorrectedFormula += "="; } - if( aFormula[nSrcPos] == '=' ) + if( nSrcPos < aFormula.getLength() && aFormula[nSrcPos] == '=' ) { nSrcPos++; nForced++; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 87713ec..de88da3 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2247,11 +2247,15 @@ void ScInputHandler::UpdateFormulaMode() { SfxApplication* pSfxApp = SFX_APP(); - if ( pEngine->GetParagraphCount() == 1 && - ( pEngine->GetText(0)[0] == '=' || - pEngine->GetText(0)[0] == '+' || - pEngine->GetText(0)[0] == '-' ) && - !bProtected ) + bool bIsFormula = !bProtected && pEngine->GetParagraphCount() == 1; + if (bIsFormula) + { + const OUString& rText = pEngine->GetText(0); + bIsFormula = !rText.isEmpty() && + (rText[0] == '=' || rText[0] == '+' || rText[0] == '-'); + } + + if ( bIsFormula ) { if (!bFormulaMode) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0769315c..1434cd4 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1328,7 +1328,7 @@ void ScViewData::EditGrowY( sal_Bool bInitial ) // Subsequent calls with empty text might involve changed attributes (including // font height), so they are treated like normal text. OUString aText = pEngine->GetText( 0 ); - if ( ( aText.isEmpty() && bInitial ) || aText[0] == '=' ) + if ( ( aText.isEmpty() && bInitial ) || (!aText.isEmpty() && aText[0] == '=') ) nAllowedExtra = SC_GROWY_BIG_EXTRA; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits