[tracker] libtracker-extract: XMP: Protect against division by zero
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-extract: XMP: Protect against division by zero
- Date: Fri, 21 May 2010 16:06:59 +0000 (UTC)
commit c0d2eb32f5265e6afc58ca9e8eb6960870588723
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 0d4e94e..925b9c3 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]