incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 118851] [From Symphony] Calc crashed if paste unsupport formula from MS Excel
Date Thu, 24 May 2012 06:20:42 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=118851

ChaoHuang <chao.dev.h@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chao.dev.h@gmail.com

--- Comment #5 from ChaoHuang <chao.dev.h@gmail.com> ---
(In reply to comment #3)
> This is caused by uninitialized call of pCode pointer in
> SCDocument::InsertTableOp()

In file "main\sc\source\core\data\cell.cxx", there is a function
"ScFormulaCell::Compile"

void ScFormulaCell::Compile( const String& rFormula, sal_Bool bNoListening,
                            const FormulaGrammar::Grammar eGrammar )
{
    if ( pDocument->IsClipOrUndo() ) return;
    sal_Bool bWasInFormulaTree = pDocument->IsInFormulaTree( this );
    if ( bWasInFormulaTree )
        pDocument->RemoveFromFormulaTree( this );
    // pCode darf fuer Abfragen noch nicht geloescht, muss aber leer sein
    if ( pCode )
        pCode->Clear();
    ScTokenArray* pCodeOld = pCode;
    ScCompiler aComp( pDocument, aPos);
        aComp.SetGrammar(eGrammar);
    pCode = aComp.CompileString( rFormula );
    if ( pCodeOld )
        delete pCodeOld;
    if( !pCode->GetCodeError() )
    {
        if ( !pCode->GetLen() && aResult.GetHybridFormula().Len() && rFormula
== aResult.GetHybridFormula() )
        {    // #65994# nicht rekursiv
CompileTokenArray/Compile/CompileTokenArray
            if ( rFormula.GetChar(0) == '=' )
                pCode->AddBad( rFormula.GetBuffer() + 1 );
            else
                pCode->AddBad( rFormula.GetBuffer() );
        }
        bCompile = sal_True;
        CompileTokenArray( bNoListening );
    }
    else
    {
        bChanged = sal_True;
        SetTextWidth( TEXTWIDTH_DIRTY );
        SetScriptType( SC_SCRIPTTYPE_UNKNOWN );
    }
    if ( bWasInFormulaTree )
        pDocument->PutInFormulaTree( this );
}

The construction of "pCode" will be ignored by condition "if (
pDocument->IsClipOrUndo() )" at the first line in function
"ScFormulaCell::Compile". In other places, there is no judgement for "pCode"
before using it. 

Can we remove the returning condition "if ( pDocument->IsClipOrUndo() )" ?
Thanks!


(In reply to comment #3)
> This is caused by uninitialized call of pCode pointer in
> SCDocument::InsertTableOp()

-- 
You are receiving this mail because:
You are the assignee for the bug.

Mime
View raw message