gst/gstvalue.c: check for validity of dates
authorStefan Kost <ensonic@users.sourceforge.net>
Wed, 18 Oct 2006 08:54:30 +0000 (08:54 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Wed, 18 Oct 2006 08:54:30 +0000 (08:54 +0000)
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_set_date), (gst_date_copy):
check for validity of dates

ChangeLog
gst/gstvalue.c

index 4b1c3a7..ff505a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-18  Stefan Kost  <ensonic@users.sf.net>
+
+       * gst/gstvalue.c: (gst_value_set_date), (gst_date_copy):
+         check for validity of dates
+
 2006-10-17  Tim-Philipp Müller  <tim at centricular dot net>
 
        * docs/gst/gstreamer-sections.txt:
index abcb93e..684abf5 100644 (file)
@@ -3726,6 +3726,7 @@ void
 gst_value_set_date (GValue * value, const GDate * date)
 {
   g_return_if_fail (G_VALUE_TYPE (value) == GST_TYPE_DATE);
+  g_return_if_fail (g_date_valid (date));
 
   g_value_set_boxed (value, date);
 }
@@ -3751,6 +3752,11 @@ gst_date_copy (gpointer boxed)
 {
   const GDate *date = (const GDate *) boxed;
 
+  if (!g_date_valid (date)) {
+    GST_WARNING ("invalid GDate");
+    return NULL;
+  }
+
   return g_date_new_julian (g_date_get_julian (date));
 }