[goffice] Fixed a potential crasher in gog_styled_object_document_changed. [#628671]



commit cb40f01b918ff061e57e45d1e53ab8fc54f8b466
Author: Jean Brefort <jean brefort normalesup org>
Date:   Fri Sep 3 10:33:26 2010 +0200

    Fixed a potential crasher in gog_styled_object_document_changed. [#628671]

 ChangeLog                         |   11 +++++++++++
 NEWS                              |    1 +
 goffice/data/go-data-simple.c     |    2 ++
 goffice/graph/gog-styled-object.c |   17 ++++++++++-------
 goffice/utils/go-styled-object.c  |    2 +-
 5 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cb4bd67..26ea953 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-03  Jean Brefort  <jean brefort normalesup org>
+
+	reviewed by: <delete if not using a buddy>
+
+	* goffice/data/go-data-simple.c (go_data_vector_val_load_values),
+	(go_data_matrix_val_load_values): update base type sizes.
+	* goffice/graph/gog-styled-object.c
+	(gog_styled_object_document_changed): fixed a potential crasher. [#628671]
+	* goffice/utils/go-styled-object.c (go_styled_object_get_style): add
+	missing space.
+
 2010-09-01  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/app/go-doc.c (load_image_data): don't unref the image at
diff --git a/NEWS b/NEWS
index 5c9dd88..a2fe961 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Jean:
 	* Don't use g_free instead of xmlFree. [#627700]
 	* Optionnaly delete trendlines from legend. [#628031]
 	* Fix critical in go_doc_finalize. [#628467]
+	* Fixed a potential crasher in gog_styled_object_document_changed. [#628671]
 
 Morten:
 	* Limit formats to sane number of decimals.  [#627066]
diff --git a/goffice/data/go-data-simple.c b/goffice/data/go-data-simple.c
index c409205..5ebd0f2 100644
--- a/goffice/data/go-data-simple.c
+++ b/goffice/data/go-data-simple.c
@@ -349,6 +349,7 @@ go_data_vector_val_load_values (GODataVector *vec)
 	}
 	vec->minimum = minimum;
 	vec->maximum = maximum;
+	vec->len = val->n;
 	vec->base.flags |= GO_DATA_CACHE_IS_VALID;
 }
 
@@ -864,6 +865,7 @@ go_data_matrix_val_load_values (GODataMatrix *mat)
 	}
 	mat->minimum = minimum;
 	mat->maximum = maximum;
+	mat->size = val->size;
 	mat->base.flags |= GO_DATA_CACHE_IS_VALID;
 }
 
diff --git a/goffice/graph/gog-styled-object.c b/goffice/graph/gog-styled-object.c
index b32f5fc..2121153 100644
--- a/goffice/graph/gog-styled-object.c
+++ b/goffice/graph/gog-styled-object.c
@@ -63,15 +63,18 @@ gog_styled_object_document_changed (GogObject *obj, GODoc *doc)
 	    (style->fill.type == GO_STYLE_FILL_IMAGE) &&
 	    (style->fill.image.image != NULL)) {
 		GOImage *image;
-		char *id = g_strdup (go_image_get_name (style->fill.image.image));
+		char *id = go_image_get_name (style->fill.image.image);
 		/* remove the (nnn) modifier if any */
-		int i = strlen (id) - 1;
-		if (id[i] == ')') {
-			i--;
-			while (id[i] >= '0' && id[i] <= '9')
+		if (id) {
+			int i = strlen (id) - 1;
+			id = g_strdup (id);
+			if (id[i] == ')') {
 				i--;
-			if (id[i] == '(')
-				id[i] = 0;
+				while (id[i] >= '0' && id[i] <= '9')
+					i--;
+				if (id[i] == '(')
+					id[i] = 0;
+			}
 		}
 		image = go_doc_add_image (doc, id, style->fill.image.image);
 		g_free (id);
diff --git a/goffice/utils/go-styled-object.c b/goffice/utils/go-styled-object.c
index 9dd16c9..7204d61 100644
--- a/goffice/utils/go-styled-object.c
+++ b/goffice/utils/go-styled-object.c
@@ -125,7 +125,7 @@ go_styled_object_set_style (GOStyledObject *gso, GOStyle *style)
  * return value: the styled object's #GOStyle
  **/
 GOStyle*
-go_styled_object_get_style(GOStyledObject *gso)
+go_styled_object_get_style (GOStyledObject *gso)
 {
 	GOStyledObjectClass *klass = GO_STYLED_OBJECT_GET_CLASS (gso);
 	g_return_val_if_fail (klass != NULL, NULL);



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