ghostpad: Make sure that nobody sets the proxypad or ghostpad itself as target
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 4 Nov 2009 16:15:59 +0000 (17:15 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 4 Nov 2009 16:17:17 +0000 (17:17 +0100)
Doing this will lead to very interesting crashes, like stack overflows.

gst/gstghostpad.c

index 2eb1a0f..e544a02 100644 (file)
@@ -1182,6 +1182,8 @@ gst_ghost_pad_set_target (GstGhostPad * gpad, GstPad * newtarget)
   GstPadLinkReturn lret;
 
   g_return_val_if_fail (GST_IS_GHOST_PAD (gpad), FALSE);
+  g_return_val_if_fail (GST_PAD_CAST (gpad) != newtarget, FALSE);
+  g_return_val_if_fail (newtarget != GST_PROXY_PAD_INTERNAL (gpad), FALSE);
 
   /* no need for locking, the internal pad's lifecycle is directly linked to the
    * ghostpad's */