[goffice] Fixed an infinite loop condition in cubic spline evaluation. [#633965]



commit 0664f819093b5d4c5833edf811237eedbe7bfb4a
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Nov 4 11:10:03 2010 +0100

    Fixed an infinite loop condition in cubic spline evaluation. [#633965]

 ChangeLog                     |    5 +++++
 NEWS                          |    1 +
 goffice/graph/gog-chart-map.c |   11 ++++++-----
 3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 30e3b6b..facdafc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-04  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/graph/gog-chart-map.c (make_path_cspline): fixed an infinite loop
+	condition. [#633965]
+
 2010-11-02  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/math/go-regression.c (go_exponential_regression): make it just
diff --git a/NEWS b/NEWS
index 2675ca9..a3e5325 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Jean:
 	* Allow filled plots to be displayed behind the grids. [#632310]
 	* Fixed patterns with cairo-1.10.
 	* Fixed flawed exponential fit in graphs for small values. [#633735]
+	* Fixed an infinite loop condition in cubic spline evaluation. [#633965]
 
 Morten:
 	* Fix GOImage-vs-cairo lifecycle issue.
diff --git a/goffice/graph/gog-chart-map.c b/goffice/graph/gog-chart-map.c
index 4af73c5..170a6ee 100644
--- a/goffice/graph/gog-chart-map.c
+++ b/goffice/graph/gog-chart-map.c
@@ -367,6 +367,7 @@ make_path_cspline (GogChartMap *map,
 				go_path_move_to (path, uu[0], vv[0]);
 				go_path_line_to (path, uu[1], vv[1]);
 			} else if (n_valid_points > 2) {
+				int j;
 				/* evaluate the spline */
 				spline = go_cspline_init (uu, vv, n_valid_points, type, p0, p1);
 				if (spline) {
@@ -374,14 +375,14 @@ make_path_cspline (GogChartMap *map,
 					x0 = uu[0];
 					y0 = vv[0];
 					go_path_move_to (path, x0, y0);
-					for (i = 1; i < spline->n; i++) {
-						x3 = uu[i];
-						y3 = vv[i];
+					for (j = 1; j < spline->n; j++) {
+						x3 = uu[j];
+						y3 = vv[j];
 						u = x3 - x0;
 						x1 = (2. * x0 + x3) / 3.;
 						x2 = (x0 + 2. * x3) / 3.;
-						y1 = y0 + spline->c[i-1] / 3. * u;
-						y2 = y0 + (2. * spline->c[i-1] + spline->b[i-1] * u) / 3. * u;
+						y1 = y0 + spline->c[j-1] / 3. * u;
+						y2 = y0 + (2. * spline->c[j-1] + spline->b[j-1] * u) / 3. * u;
 						go_path_curve_to (path, x1, y1, x2, y2, x3, y3);
 						x0 = x3;
 						y0 = y3;



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