[brasero] Another try at #606010 - crashes at audio CD insertion



commit 1ff673afb2b93b9a322dd6b65588840e025fa068
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Thu Jul 22 10:10:38 2010 +0200

    Another try at #606010 - crashes at audio CD insertion

 libbrasero-media/brasero-medium.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/libbrasero-media/brasero-medium.c b/libbrasero-media/brasero-medium.c
index a8e24f8..34d38d3 100644
--- a/libbrasero-media/brasero-medium.c
+++ b/libbrasero-media/brasero-medium.c
@@ -2793,8 +2793,13 @@ brasero_medium_read_CD_TEXT (BraseroMedium *self,
 
 	/* Get the number of CD-Text Data Packs.
 	 * Some drives seem to report an idiotic cd_text->hdr->len. So use size
-	 * to be on the safe side. */
-	num = (size - sizeof (BraseroScsiTocPmaAtipHdr)) / sizeof (BraseroScsiCDTextPackData);
+	 * to be on a safer side. */
+	if (size < sizeof (BraseroScsiTocPmaAtipHdr)) {
+		g_free (cd_text);
+		return;
+	}
+
+	num = (num - sizeof (BraseroScsiTocPmaAtipHdr)) / sizeof (BraseroScsiCDTextPackData);
 	if (num <= 0) {
 		g_free (cd_text);
 		return;



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