[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kchart/shape
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2010-04-22 11:24:10
Message-ID: 20100422112410.C0BF8AC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1117504 by sebsauer:

Check for invalid 'first' and 'last' values and adjust them to be valid if possible. \
This fixes a crash that happens cause the produced ODS references cell's which are \
outside of our dataset's (see bug #158840)


 M  +13 -1     KDChartModel.cpp  


--- trunk/koffice/kchart/shape/KDChartModel.cpp #1117503:1117504
@@ -203,9 +203,21 @@
     if ( !d->dataSets.contains( dataSet ) )
         return;
 
+    // be sure the 'first' and 'last' referenced rows are within our boundaries
+    const int rows = rowCount();
+    if ( first >= rows )
+        first = rows - 1;
+    if ( last >= rows )
+        last = rows - 1;
     // 'last' defaults to -1, which means only one column was changed
     if ( last == -1 )
-        last = first;
+    // 'first' can be negative either cause rowCount()==0 or cause it still contains \
the default value of -1. In both cases we abort +    // and don't progress the \
update-request future. Same is true for last which should at this point contain a \
valid row index too. +    if ( first < 0 || last < 0 )
+        return;
+    // be sure we are not dealing with inverse order
+    if ( last < first )
+        qSwap(first , last);
 
     int dataSetColumn = d->dataSetIndex( dataSet ) * dataDimensions();
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic