After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658584 - empathy-av crashed with SIGSEGV in gst_color_balance_list_channels()
empathy-av crashed with SIGSEGV in gst_color_balance_list_channels()
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: VoIP
3.1.x
Other Linux
: Normal critical
: 3.2
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-08 17:04 UTC by Cristian Aravena Romero
Modified: 2011-09-09 12:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
video-src: factor out dup_color_balance() (3.29 KB, patch)
2011-09-09 11:46 UTC, Guillaume Desmottes
committed Details | Review
dup_color_balance: check that element currently implements GstColorBalance (1002 bytes, patch)
2011-09-09 11:46 UTC, Guillaume Desmottes
committed Details | Review

Description Cristian Aravena Romero 2011-09-08 17:04:01 UTC
Open bug in launchpad.net:
https://bugs.launchpad.net/bugs/844904

Package: empathy 3.1.91-0ubuntu1

"In a call, I was playing with the video controls, when empathy-av crashed."

  • #0 gst_color_balance_list_channels
    at colorbalance.c line 127
  • #1 empathy_video_src_get_supported_channels
    at empathy-video-src.c line 341
  • #2 empathy_streamed_media_window_setup_video_input
    at empathy-streamed-media-window.c line 449
  • #3 empathy_streamed_media_window_bus_message
    at empathy-streamed-media-window.c line 2613
  • #4 gst_bus_source_dispatch
    at gstbus.c line 761
  • #5 g_main_dispatch
    at /build/buildd/glib2.0-2.29.90/./glib/gmain.c line 2441
  • #6 g_main_context_dispatch
    at /build/buildd/glib2.0-2.29.90/./glib/gmain.c line 3011
  • #7 g_main_context_iterate
    at /build/buildd/glib2.0-2.29.90/./glib/gmain.c line 3089
  • #8 g_main_loop_run
    at /build/buildd/glib2.0-2.29.90/./glib/gmain.c line 3297
  • #9 gtk_main
    at /build/buildd/gtk+3.0-3.1.18/./gtk/gtkmain.c line 1367
  • #10 g_application_run
    at /build/buildd/glib2.0-2.29.90/./gio/gapplication.c line 1323
  • #11 main
    at empathy-av.c line 162

Comment 1 Guillaume Desmottes 2011-09-09 09:04:13 UTC
Interesting. Looks like we are passing NULL to gst_color_balance_list_channels().

Here is the code:


  color = gst_bin_get_by_interface (GST_BIN (src), GST_TYPE_COLOR_BALANCE);

  if (color == NULL)
    goto out;

  balance = GST_COLOR_BALANCE (color);

  channels = gst_color_balance_list_channels (balance);


So, color is not NULL but balance is, which means that color doesn't actually implement GstColorBalance which sounds like a bug in gst_bin_get_by_interface().
Comment 2 Guillaume Desmottes 2011-09-09 09:04:30 UTC
According to the Ubuntu bug this is with gstreamer0.10-plugins-base 0.10.35-1
Comment 3 Tim-Philipp Müller 2011-09-09 09:27:08 UTC
> So, color is not NULL but balance is, which means that color doesn't actually
> implement GstColorBalance which sounds like a bug in
> gst_bin_get_by_interface().

If this was the case, there should be a Critical/Warning in the XSession log I think, but there isn't, is there? (Not that I have a better explanation right now).
Comment 4 Tim-Philipp Müller 2011-09-09 09:37:50 UTC
It's also worth noting that GstColorBalance is one of those interfaces that's wrapped by the horrible GstImplementsInterface interface, which attempted to provide interfaces on a per-instance basis, so to say.

gst_bin_get_by_interface() will just use the GType checks to check for the interface implementation (which will succeed for all instances that advertise the GstColorBalance interface), while the GST_COLOR_BALANCE() cast macro will fail for instances that don't support the color balance interface at the moment for whatever reason (usually either because some device isn't open yet, i.e. it's not in a state >=READY, or because the particular device opened doesn't support this functionality).

(You can see why we've gotten rid of this in 0.11)
Comment 5 Tim-Philipp Müller 2011-09-09 10:00:39 UTC
So in short, I think you will have to add something like this:

  /* colorbalance is wrapped by GstImplementsInterface, we
   * need to check if it is actually supported for this instance
   * in its current state before trying to use it */
  if (!GST_IS_COLOR_BALANCE (color))
      goto out;

  balance = GST_COLOR_BALANCE (color);


(Don't think gst_bin_get_by_interface() can or should check against the GstImplementsInterface stuff)
Comment 6 Guillaume Desmottes 2011-09-09 11:33:34 UTC
Thanks for the explanation, let's do that then.
Comment 7 Guillaume Desmottes 2011-09-09 11:46:03 UTC
Created attachment 196096 [details] [review]
video-src: factor out dup_color_balance()
Comment 8 Guillaume Desmottes 2011-09-09 11:46:08 UTC
Created attachment 196097 [details] [review]
dup_color_balance: check that element currently implements GstColorBalance
Comment 9 Tim-Philipp Müller 2011-09-09 11:52:13 UTC
Just to be sure, I don't know exactly what's happening here, I was just speculating. It's the only explanation I can think of though. The additional check would avoid a crash like in the stack trace, but possibly you want to do something else here (e.g. set state to READY if it's a video source and it's still in NULL state or so). Depends on the context of course, which I don't know.
Comment 10 Guillaume Desmottes 2011-09-09 11:59:41 UTC
I suspect that's a race: user tries to change colorspace while the element isn't READY yet. Anyway, if those commits look good to you I'll merge them as they can't hurt and are good from a safe programming pov.
Comment 11 Tim-Philipp Müller 2011-09-09 12:16:36 UTC
Looks fine to me, and should be safe in any case. I've also added some guards to the colorbalance functions in GStreamer now.
Comment 12 Guillaume Desmottes 2011-09-09 12:29:20 UTC
Attachment 196096 [details] pushed as 890efc4 - video-src: factor out dup_color_balance()
Attachment 196097 [details] pushed as c785ff7 - dup_color_balance: check that element currently implements GstColorBalance