ooo-build r11210 - in trunk: . patches/src680



Author: kyoshida
Date: Mon Jan  7 18:51:30 2008
New Revision: 11210
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11210&view=rev

Log:
2008-01-07  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/sc-openformula-sumif.diff: fixed crash problem on out-
	of-bound cell ranges.



Modified:
   trunk/ChangeLog
   trunk/patches/src680/sc-openformula-sumif.diff

Modified: trunk/patches/src680/sc-openformula-sumif.diff
==============================================================================
--- trunk/patches/src680/sc-openformula-sumif.diff	(original)
+++ trunk/patches/src680/sc-openformula-sumif.diff	Mon Jan  7 18:51:30 2008
@@ -1,11 +1,10 @@
-? sc/sc.vpj
 Index: sc/source/core/tool/interpr1.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/core/tool/interpr1.cxx,v
 retrieving revision 1.53
 diff -u -r1.53 interpr1.cxx
 --- sc/source/core/tool/interpr1.cxx	1 Nov 2007 16:23:17 -0000	1.53
-+++ sc/source/core/tool/interpr1.cxx	4 Jan 2008 21:06:33 -0000
++++ sc/source/core/tool/interpr1.cxx	7 Jan 2008 18:39:18 -0000
 @@ -4165,31 +4165,34 @@
          SCCOL nCol3 = 0;
          SCROW nRow3 = 0;
@@ -53,37 +52,46 @@
  		}
  		String rString;
          double fVal = 0.0;
-@@ -4273,7 +4276,19 @@
+@@ -4273,21 +4276,33 @@
  			SetIllegalParameter();
  			return;
  		}
 -		if (nParamCount != 3)
 +
-+        SCCOL nCol4;
-+        SCROW nRow4;
-+        SCTAB nTab4;
-+		if (nParamCount == 3)
++        if (nParamCount == 3)
 +        {
-+            // Take the range geometry of the 1st parameter and apply it to
-+            // the 3rd.
-+            nCol4 = nCol3 + nCol2 - nCol1;
-+            nRow4 = nRow3 + nRow2 - nRow1;
-+            nTab4 = nTab3 + nTab2 - nTab1;
++            // Make sure the calculated cell ranges will not fall outside the
++            // allowed ranges (to prevent crash).
++
++            SCCOL nColDelta = nCol2 - nCol1;
++            SCROW nRowDelta = nRow2 - nRow1;
++            if (nCol3 + nColDelta >= MAXCOLCOUNT)
++            {
++                SCCOL nNewDelta = MAXCOLCOUNT - 1 - nCol3;
++                nCol2 = nCol1 + nNewDelta;
++            }
++
++            if (nRow3 + nRowDelta >= MAXROWCOUNT)
++            {
++                SCROW nNewDelta = MAXROWCOUNT - 1 - nRow3;
++                nRow2 = nRow1 + nNewDelta;
++            }
 +        }
 +        else
  		{
  			nCol3 = nCol1;
  			nRow3 = nRow1;
-@@ -4282,12 +4297,7 @@
- 			nRow4 = nRow2;
- 			nTab4 = nTab2;
- 		}
+ 			nTab3 = nTab1;
+-			nCol4 = nCol2;
+-			nRow4 = nRow2;
+-			nTab4 = nTab2;
+-		}
 -		else if (nCol4 - nCol3 != nCol2 - nCol1 ||
 -				 nRow4 - nRow3 != nRow2 - nRow1 || nCol1 > nCol2)
 -		{
 -			SetIllegalParameter();
 -			return;
--		}
+ 		}
 +
  		if (nGlobalError == 0)
  		{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]