[tracker/tracker-0.8] libtracker-extract: XMP: Protect against division by zero



commit 3ff7f01948be1e82cf0de5348c8ead94ec113351
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri May 21 18:05:32 2010 +0200

    libtracker-extract: XMP: Protect against division by zero

 src/libtracker-extract/tracker-xmp.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index 989e5f3..c5275c9 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -163,7 +163,10 @@ div_str_dup (const gchar *value)
 		cpy [ptr - value] = '\0';
 		a = atoi (cpy);
 		b = atoi (cpy + (ptr - value) + 1);
-		ret = g_strdup_printf ("%G", ((gdouble)((gdouble) a / (gdouble) b)));
+		if (b != 0)
+			ret = g_strdup_printf ("%G", ((gdouble)((gdouble) a / (gdouble) b)));
+		else
+			ret = NULL;
 		g_free (cpy);
 	} else {
 		ret = g_strdup (value);



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