gst/gstpad.c: Don't crash when trying to fixate and empty list.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 4 Jan 2008 18:39:15 +0000 (18:39 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 4 Jan 2008 18:39:15 +0000 (18:39 +0000)
Original commit message from CVS:
* gst/gstpad.c: (fixate_value):
Don't crash when trying to fixate and empty list.
Fixes #506643.

ChangeLog
gst/gstpad.c

index a9ffc5f..176efd2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-04  Wim Taymans  <wim.taymans@collabora.co.uk>
+
+       * gst/gstpad.c: (fixate_value):
+       Don't crash when trying to fixate and empty list.
+       Fixes #506643.
+
 2008-01-03  Sebastian Dröge  <slomo@circular-chaos.org>
 
        * docs/faq/gst-uninstalled:
index 1dca9ec..eaac968 100644 (file)
@@ -2120,7 +2120,12 @@ fixate_value (GValue * dest, const GValue * src)
   } else if (G_VALUE_TYPE (src) == GST_TYPE_LIST) {
     GValue temp = { 0 };
 
+    /* list could be empty */
+    if (gst_value_list_get_size (src) <= 0)
+      return FALSE;
+
     gst_value_init_and_copy (&temp, gst_value_list_get_value (src, 0));
+
     if (!fixate_value (dest, &temp))
       gst_value_init_and_copy (dest, &temp);
     g_value_unset (&temp);