gnumeric r16339 - in branches/gnumeric-1-8: . plugins/excel



Author: mortenw
Date: Sat Feb  2 17:22:29 2008
New Revision: 16339
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16339&view=rev

Log:
2008-02-02  Morten Welinder  <terra gnome org>

	* ms-excel-read.c (excel_read_HLINK): Be even stricter about record lengths.



Modified:
   branches/gnumeric-1-8/NEWS
   branches/gnumeric-1-8/plugins/excel/ChangeLog
   branches/gnumeric-1-8/plugins/excel/ms-excel-read.c

Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS	(original)
+++ branches/gnumeric-1-8/NEWS	Sat Feb  2 17:22:29 2008
@@ -1,5 +1,8 @@
 Gnumeric 1.8.2
 
+Hans de Goede:
+	* Fix broken xls issues.  [#505330]
+
 Morten:
 	* Fix loading of solver constraints.
 	* Fix solver issue.  [#512500]

Modified: branches/gnumeric-1-8/plugins/excel/ms-excel-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/excel/ms-excel-read.c	(original)
+++ branches/gnumeric-1-8/plugins/excel/ms-excel-read.c	Sat Feb  2 17:22:29 2008
@@ -5128,6 +5128,7 @@
 	});
 
 	if ((options & 0x14) == 0x14) {			/* label */
+		XL_NEED_ITEMS (1, 4);
 		len = GSF_LE_GET_GUINT32 (data);
 		data += 4;
 		XL_NEED_ITEMS (len, 2);
@@ -5137,6 +5138,7 @@
 	}
 
 	if (options & 0x80) {				/* target_base */
+		XL_NEED_ITEMS (1, 4);
 		len = GSF_LE_GET_GUINT32 (data);
 		data += 4;
 		XL_NEED_ITEMS (len, 2);
@@ -5146,8 +5148,10 @@
 	}
 
 	if (options & 0x8) {				/* 'text mark' */
+		XL_NEED_ITEMS (1, 4);
 		len = GSF_LE_GET_GUINT32 (data);
 		data += 4;
+
 		XL_NEED_ITEMS (len, 2);
 		mark = read_utf16_str (len, data);
 		data += len*2;
@@ -5158,10 +5162,11 @@
 		guchar *url;
 
 		data += sizeof (url_guid);
+		XL_NEED_ITEMS (1, 4);
 		len = GSF_LE_GET_GUINT32 (data);
 		data += 4;
-		XL_NEED_BYTES (len);
 
+		XL_NEED_BYTES (len);
 		url = read_utf16_str (len/2, data);
 		if (NULL != url && 0 == g_ascii_strncasecmp (url,  "mailto:";, 7))
 			link = g_object_new (gnm_hlink_email_get_type (), NULL);
@@ -5175,17 +5180,25 @@
 		guchar  *path;
 		GString *accum;
 		int up;
+
 		data += sizeof (file_guid);
+
+		XL_NEED_BYTES (6);
 		up  = GSF_LE_GET_GUINT16 (data + 0);
 		len = GSF_LE_GET_GUINT32 (data + 2);
 		d (1, fprintf (stderr,"# leading ../ %d len 0x%04x\n",
 				 up, len););
 		data += 6;
+
 		XL_NEED_BYTES (len);
-		data += len + 16 + 12;
+		data += len;
+
+		XL_NEED_BYTES (16 + 12 + 6);
+		data += 16 + 12;
 		len = GSF_LE_GET_GUINT32 (data);
 		data += 6;
 
+		XL_NEED_BYTES (len);
 		path = read_utf16_str (len/2, data);
 		accum = g_string_new (NULL);
 		while (up-- > 0)
@@ -5200,8 +5213,12 @@
 	} else if ((options & 0x1e3) == 0x103) {
 		guchar  *path;
 
+		XL_NEED_ITEMS (1, 4);
 		len = GSF_LE_GET_GUINT32 (data);
-		path = read_utf16_str (len*2, data+4);
+		data += 4;
+
+		XL_NEED_BYTES (len);
+		path = read_utf16_str (len/2, data);
 		link = g_object_new (gnm_hlink_external_get_type (), NULL);
 		gnm_hlink_set_target (link, path);
 		g_free (path);



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