diff options
author | Armin Le Grand <alg@apache.org> | 2014-01-17 22:32:30 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2014-01-17 22:32:30 +0000 |
commit | 5cc9cb9c52617bab6eb6d84331dde8f3d580ee31 (patch) | |
tree | 98245d5f637b18d1a36da4ea4b2b6722c4a920e7 /sc | |
parent | bb94c19d2c7df1c468d38b7744e0d34e8ac27a99 (diff) |
i123870 corrected import values on xml import with chart, avoid uninitialized values
Notes
Notes:
ignore: fixed
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/refdata.hxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/reftokenhelper.cxx | 12 | ||||
-rw-r--r-- | sc/source/filter/excel/excform8.cxx | 8 |
4 files changed, 33 insertions, 1 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 88980a2a3231..3338e255cfd6 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -465,7 +465,7 @@ public: public: SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT, SfxObjectShell* pDocShell = NULL ); - SC_DLLPUBLIC ~ScDocument(); + SC_DLLPUBLIC virtual ~ScDocument(); inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceManager() const { return xServiceManager; } diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx index d729d22013bc..9550b82c9e97 100644 --- a/sc/inc/refdata.hxx +++ b/sc/inc/refdata.hxx @@ -76,6 +76,10 @@ struct SC_DLLPUBLIC ScSingleRefData // Single reference (one address) int // No default ctor, because used in ScRawToken union, set InitFlags! inline void InitFlags() { bFlags = 0; } // all FALSE + + // #123870# Make it possible to init members to some defined values + inline void InitMembers() { nCol = nRow = nTab = nRelCol = nRelRow = nRelTab = 0; } + // InitAddress: InitFlags and set address inline void InitAddress( const ScAddress& rAdr ); inline void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab ); @@ -157,6 +161,14 @@ struct ScComplexRefData // Complex reference (a range) into the sheet inline void InitFlags() { Ref1.InitFlags(); Ref2.InitFlags(); } + + // #123870# Make it possible to init members to some defined values + inline void InitMembers() + { + Ref1.InitMembers(); + Ref2.InitMembers(); + } + inline void InitRange( const ScRange& rRange ) { Ref1.InitAddress( rRange.aStart ); diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index f15f5a0578e6..7f6fde54c962 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -146,6 +146,12 @@ bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScSharedTokenRef return false; const ScSingleRefData& rRefData = pToken->GetSingleRef(); + + if(!rRefData.Valid()) + { + OSL_ENSURE(false, "RefData out of range, correct before usage (!)"); + } + rRange.aStart.SetCol(rRefData.nCol); rRange.aStart.SetRow(rRefData.nRow); rRange.aStart.SetTab(rRefData.nTab); @@ -160,6 +166,12 @@ bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScSharedTokenRef return false; const ScComplexRefData& rRefData = pToken->GetDoubleRef(); + + if(!rRefData.Valid()) + { + OSL_ENSURE(false, "RefData out of range, correct before usage (!)"); + } + rRange.aStart.SetCol(rRefData.Ref1.nCol); rRange.aStart.SetRow(rRefData.Ref1.nRow); rRange.aStart.SetTab(rRefData.Ref1.nTab); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 84955b422d81..a940d0115239 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -124,6 +124,10 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nEndPos = aIn.GetRecPos() + nFormulaLen; + // #123870# Init members, they are on random values and not all will beinitialized in all cases below + aSRD.InitMembers(); + aCRD.InitMembers(); + while( (aIn.GetRecPos() < nEndPos) && !bError ) { aIn >> nOp; @@ -1244,6 +1248,10 @@ ConvErr ExcelToSc8::ConvertExternName( const ScTokenArray*& rpArray, XclImpStrea sal_Size nEndPos = rStrm.GetRecPos() + nFormulaLen; + // #123870# Init members, they are on random values and not all will beinitialized in all cases below + aSRD.InitMembers(); + aCRD.InitMembers(); + while( (rStrm.GetRecPos() < nEndPos) && !bError ) { rStrm >> nOp; |