[goffice] Don't access NULL X or Y values in YXZ matrix plots. [#754590]



commit 813eabc31ed3cd7765312f78ae1cbb7c2085ebb9
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Sep 5 09:33:33 2015 +0200

    Don't access NULL X or Y values in YXZ matrix plots. [#754590]

 ChangeLog                              |    5 +++++
 NEWS                                   |    1 +
 plugins/plot_surface/gog-xyz-surface.c |    8 ++++----
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b5bfc52..3782a20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-05  Jean Brefort  <jean brefort normalesup org>
+
+       * plugins/plot_surface/gog-xyz-surface.c
+       (gog_xyz_matrix_plot_build_matrix): don't access NULL values. [#754590]
+
 2015-08-24  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/canvas/goc-path.c (goc_path_prepare_draw): fix bounds and distance
diff --git a/NEWS b/NEWS
index 9e63f71..a160e58 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.10.24:
 
 Jean:
        * Fix bounds and distance for rectangle and paths in RTL mode. [#753963]
+       * Don't access NULL X or Y values in YXZ matrix plots. [#754590]
 
 --------------------------------------------------------------------------
 goffice 0.10.23:
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index 7f0b689..53d373a 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -167,18 +167,18 @@ gog_xyz_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_change
        grid = g_new0 (unsigned, n);
 
        l = index = 0;
-       while (l < kmax && y_vals[sort[l]] < y_limits[0])
+       while (l < kmax && y_vals && y_vals[sort[l]] < y_limits[0])
                l++;
        k = l;
        for (i = 1; i < imax; i++) {
-               while (l < kmax && y_vals[sort[l]] <= y_limits[i])
+               while (l < kmax && y_vals && y_vals[sort[l]] <= y_limits[i])
                        l++;
                g_qsort_with_data (sort + k, l - k, sizeof (unsigned), (GCompareDataFunc) data_compare, 
&raw_data);
-               while (k < l && x_vals[sort[k]] < x_limits[0])
+               while (k < l && x_vals && x_vals[sort[k]] < x_limits[0])
                        k++;
                for (j = 1; j < jmax && k < l; j++) {
                        index = (i - 1) * plot->columns + j - 1;
-                       while (k < l && x_vals[sort[k]] <= x_limits[j]) {
+                       while (k < l && x_vals && x_vals[sort[k]] <= x_limits[j]) {
                                if (G_LIKELY (index < n)) {
                                        data[index] += (z_vals)? z_vals[sort[k]]: 1;
                                        grid[index]++;


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