brasero r2197 - in trunk: . libbrasero-media



Author: philippr
Date: Wed Apr  1 18:27:39 2009
New Revision: 2197
URL: http://svn.gnome.org/viewvc/brasero?rev=2197&view=rev

Log:
2009-04-01  Philippe Rouquier  <bonfire-app wanadoo fr>

	Fix for #573929 â nautilus crashed with SIGSEGV in start_thread()

	* libbrasero-media/brasero-medium.c
	(brasero_medium_get_page_2A_write_speed_desc):

Modified:
   trunk/ChangeLog
   trunk/libbrasero-media/brasero-medium.c

Modified: trunk/libbrasero-media/brasero-medium.c
==============================================================================
--- trunk/libbrasero-media/brasero-medium.c	(original)
+++ trunk/libbrasero-media/brasero-medium.c	Wed Apr  1 18:27:39 2009
@@ -1362,7 +1362,9 @@
 
 	page_2A = (BraseroScsiStatusPage *) &data->page;
 
-	if (size < 18) {
+	/* Reminder: size = sizeof (BraseroScsiStatusPage) + sizeof (BraseroScsiModeHdr) */
+	if (size < (G_STRUCT_OFFSET (BraseroScsiStatusPage, copy_mngt_rev) +
+		    sizeof (BraseroScsiModeHdr))) {
 		g_free (data);
 		BRASERO_MEDIA_LOG ("wrong page size");
 		return BRASERO_BURN_ERR;
@@ -1371,8 +1373,11 @@
 	priv->max_rd = BRASERO_GET_16 (page_2A->rd_max_speed);
 	priv->max_wrt = BRASERO_GET_16 (page_2A->wr_max_speed);
 
-	/* Check if we can use the speed descriptors; if not use maximum */
-	if (size < 20) {
+	/* Check if we can use the speed descriptors. There must be at least one
+	 * available; if not use maximum speed member. */
+	if (size < (G_STRUCT_OFFSET (BraseroScsiStatusPage, wr_spd_desc) +
+		    sizeof (BraseroScsiModeHdr) +
+		    sizeof (BraseroScsiWrtSpdDesc))) {
 		BRASERO_MEDIA_LOG ("Maximum Speed (Page 2A [old]) %i", priv->max_wrt);
 
 		/* also add fake speed descriptors */



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