gnumeric r16650 - in trunk: . plugins/excel



Author: jody
Date: Mon Jun 23 02:03:58 2008
New Revision: 16650
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16650&view=rev

Log:
* Be more careful with corrupt xls records. [#539666]


Modified:
   trunk/NEWS
   trunk/plugins/excel/ChangeLog
   trunk/plugins/excel/ms-biff.c
   trunk/plugins/excel/xlsx-write.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Jun 23 02:03:58 2008
@@ -20,6 +20,7 @@
 	* Support Some XLM functions commonly used in charting.
 	* Fix xls import of charts in charts.
 	* Fix display confusion when reordering away from RTL sheet. [#499910]
+	* Be more careful with corrupt xls records. [#539666]
 
 Morten:
 	* Fix Excel export problem for strings that need quoting.  [#530704]

Modified: trunk/plugins/excel/ms-biff.c
==============================================================================
--- trunk/plugins/excel/ms-biff.c	(original)
+++ trunk/plugins/excel/ms-biff.c	Mon Jun 23 02:03:58 2008
@@ -406,6 +406,7 @@
 ms_biff_query_next (BiffQuery *q)
 {
 	guint8 const *data;
+	guint16 len;
 
 	g_return_val_if_fail (q != NULL, FALSE);
 
@@ -428,17 +429,20 @@
 	if (data == NULL)
 		return FALSE;
 	q->opcode = GSF_LE_GET_GUINT16 (data);
-	q->length = GSF_LE_GET_GUINT16 (data + 2);
+	len = GSF_LE_GET_GUINT16 (data + 2);
+
+	q->data   = NULL;
+	q->length = 0;
 
 	/* no biff record should be larger than around 20,000 */
-	XL_CHECK_CONDITION_VAL (q->length < 20000, FALSE);
+	XL_CHECK_CONDITION_VAL (len < 20000, FALSE);
 
+	q->length = len;
 	if (q->length > 0) {
 		q->data = (guint8 *)gsf_input_read (q->input, q->length, NULL);
 		if (q->data == NULL)
 			return FALSE;
-	} else
-		q->data = NULL;
+	}
 
 	if (q->encryption == MS_BIFF_CRYPTO_RC4) {
 		q->non_decrypted_data_malloced = q->data_malloced;

Modified: trunk/plugins/excel/xlsx-write.c
==============================================================================
--- trunk/plugins/excel/xlsx-write.c	(original)
+++ trunk/plugins/excel/xlsx-write.c	Mon Jun 23 02:03:58 2008
@@ -976,9 +976,9 @@
 static void
 xlsx_write_chart (XLSXWriteState *state, GsfOutput *chart_part, SheetObject *so)
 {
-	GogGraph const	*graph = sheet_object_graph_get_gog (so);
-	GogObject const	*chart = gog_object_get_child_by_name (GOG_OBJECT (graph), "Chart");
-	GogObject const *plot = gog_object_get_child_by_name (GOG_OBJECT (chart), "Plot");
+	GogGraph const	*graph;
+	GogObject const	*chart;
+	GogObject const *plot;
 	char const *plot_type;
 	GogObject const *obj;
 	GsfXMLOut *xml;



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