libgsf r1009 - in trunk: . gsf



Author: mortenw
Date: Sun Oct  5 17:56:23 2008
New Revision: 1009
URL: http://svn.gnome.org/viewvc/libgsf?rev=1009&view=rev

Log:
2008-10-05  Morten Welinder  <terra gnome org>

	* gsf/gsf-infile-msole.c (ole_info_read_metabat): Use g_warning,
	not g_return_val_if_fail.  Fixes #554848.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/gsf/gsf-infile-ar.c
   trunk/gsf/gsf-infile-msole.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sun Oct  5 17:56:23 2008
@@ -7,6 +7,7 @@
 	* Work around sshfs bug.  [#509883]
 	* Support tar archives.
 	* Improve gsf support for broken archives.  [#553861]
+	* Avoid a critical for bad ole2.  [#554848]
 
 --------------------------------------------------------------------------
 libgsf 1.14.9

Modified: trunk/gsf/gsf-infile-ar.c
==============================================================================
--- trunk/gsf/gsf-infile-ar.c	(original)
+++ trunk/gsf/gsf-infile-ar.c	Sun Oct  5 17:56:23 2008
@@ -301,7 +301,7 @@
 	else if (len < AR_HEADER_LEN)
 		return AR_FAILURE;
 	else {
-		gsf_input_read (fp, AR_HEADER_LEN, header);
+		gsf_input_read (fp, AR_HEADER_LEN, (guint8*)header);
 		if (strncmp (header->fmag, AR_FMAG, 2))
 			return AR_FAILURE;
 		return AR_SUCCESS;
@@ -319,6 +319,9 @@
 static gboolean
 gsf_infile_ar_seek (GsfInput *input, gsf_off_t offset, GSeekType whence)
 {
+	(void)input;
+	(void)offset;
+	(void)whence;
 	return FALSE;
 }
 
@@ -478,5 +481,5 @@
 	}
 	ar->vdir = ar->info->vdir;
 
-	return ar;
+	return GSF_INFILE (ar);
 }

Modified: trunk/gsf/gsf-infile-msole.c
==============================================================================
--- trunk/gsf/gsf-infile-msole.c	(original)
+++ trunk/gsf/gsf-infile-msole.c	Sun Oct  5 17:56:23 2008
@@ -205,8 +205,11 @@
 			end = bat + ole->info->bb.size;
 			for ( ; bat < end ; bat += BAT_INDEX_SIZE, bats++) {
 				*bats = GSF_LE_GET_GUINT32 (bat);
-				g_return_val_if_fail (*bats < max_bat ||
-						      *bats >= BAT_MAGIC_METABAT, NULL);
+				if (*bats >= max_bat && *bats < BAT_MAGIC_METABAT) {
+					g_warning ("Invalid metabat item %08x",
+						   *bats);
+					return NULL;
+				}
 			}
 		} else {
 			/* Looks like something in the wild sometimes creates
@@ -930,8 +933,7 @@
 
 	calling_pos = gsf_input_tell (source);
 	if (ole_init_info (ole, err)) {
-		/* It's not clear to me why we do this.  And if this
-		   fails, there's really nothing we can do.  */
+		/* We do this so other kinds of archives can be tried.  */
 		(void)gsf_input_seek (source, calling_pos, G_SEEK_SET);
 
 		g_object_unref (G_OBJECT (ole));



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