summaryrefslogtreecommitdiffstats
path: root/binfilter/bf_sch/source/core/sch_chtmode3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'binfilter/bf_sch/source/core/sch_chtmode3.cxx')
-rw-r--r--binfilter/bf_sch/source/core/sch_chtmode3.cxx43
1 files changed, 29 insertions, 14 deletions
diff --git a/binfilter/bf_sch/source/core/sch_chtmode3.cxx b/binfilter/bf_sch/source/core/sch_chtmode3.cxx
index beda65ca6..3df2d181d 100644
--- a/binfilter/bf_sch/source/core/sch_chtmode3.cxx
+++ b/binfilter/bf_sch/source/core/sch_chtmode3.cxx
@@ -67,6 +67,9 @@
#include "chaxis.hxx"
+#include <limits>
+#include <algorithm>
+
namespace binfilter {
/*************************************************************************
@@ -270,20 +273,17 @@ namespace binfilter {
/*N*/ const SfxItemSet& ChartModel::GetDataRowAttr( long nRow ) const
/*N*/ {
-/*N*/ if( nRow < (long)aDataRowAttrList.size() )
+/*N*/ if( nRow>=0 && nRow < (long)aDataRowAttrList.size() )
/*N*/ {
/*N*/ SfxItemSet* pSet = aDataRowAttrList[ nRow ];
/*N*/ DBG_ASSERT( pSet, "Invalid ItemSet" );
-/*N*/ return *pSet;
-/*N*/ }
-/*N*/ else
-/*N*/ {
-/*N*/ OSL_FAIL( "Requested data row attribute is unavailable" );
-/*N*/
-/*N*/ // return something
-/*?*/ DBG_ASSERT( pChartAttr, "Invalid Chart-ItemSet" );
-/*?*/ return *pChartAttr;
+ if( pSet )
+/*N*/ return *pSet;
/*N*/ }
+/*N*/ OSL_FAIL( "Requested data row attribute is unavailable" );
+/*N*/ // return something
+/*?*/ DBG_ASSERT( pChartAttr, "Invalid Chart-ItemSet" );
+/*?*/ return *pChartAttr;
/*N*/ }
/*************************************************************************
@@ -675,11 +675,25 @@ namespace binfilter {
/*N*/ ? &aSwitchDataPointAttrList
/*N*/ : &aDataPointAttrList;
/*N*/
-/*N*/ SfxItemSet* pItemSet = (*pAttrList)[ nCol * GetRowCount() + nRow ];
+ if( nCol < 0 || nRow < 0 )
+ return;
+ const long nRowCount = GetRowCount();
+ const long nColCount = GetColCount();
+ if( nColCount <= 0 || nRowCount <= 0 )
+ return;
+ if( nCol >= nColCount || nRow >= nRowCount )
+ return;
+ if( nCol > ::std::numeric_limits<long>::max()/nRowCount ) //sal_uIntPtr is the type of the index parameter for method pAttrList->GetObject
+ return;
+ if( nRowCount*nCol > ::std::numeric_limits<long>::max() - nRow )
+ return;
+ sal_uIntPtr nIndex = static_cast<sal_uIntPtr>(nCol) * nRowCount + nRow;
+
+/*N*/ SfxItemSet* pItemSet = (*pAttrList)[ nCol * GetRowCount() + nRow ];
/*N*/ if (pItemSet == NULL)
/*N*/ {
/*N*/ pItemSet = new SfxItemSet(*pItemPool, nRowWhichPairs);
-/*N*/ (*pAttrList)[nCol * GetRowCount() + nRow] = pItemSet;
+/*N*/ (*pAttrList)[nIndex] = pItemSet;
/*N*/ }
/*N*/ if(!bMerge)
/*?*/ pItemSet->ClearItem();
@@ -774,10 +788,11 @@ namespace binfilter {
/*N*/ SfxItemSet aAttr( GetDataRowAttr( nCol % nPieCount ));
/*N*/
/*N*/ if( ( nCol >= nPieCount ) &&
-/*N*/ pDefaultColors )
+/*N*/ pDefaultColors && pDefaultColors->size()>0 )
/*N*/ {
/*?*/ XColorEntry* pColEntry = (*pDefaultColors)[ nCol % pDefaultColors->size() ];
-/*?*/ aAttr.Put( XFillColorItem( pColEntry->GetName(), pColEntry->GetColor()));
+ if( pColEntry )
+/*?*/ aAttr.Put( XFillColorItem( pColEntry->GetName(), pColEntry->GetColor()));
/*N*/ }
/*N*/
/*N*/ // add description attributes of series