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 782095 - decodebin: Crash on shutdown with chained opus file
decodebin: Crash on shutdown with chained opus file
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal critical
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 782157
 
 
Reported: 2017-05-03 06:23 UTC by Victor Toso
Modified: 2017-06-05 12:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix user after free (1.91 KB, patch)
2017-05-03 15:04 UTC, Vincent Penquerc'h
committed Details | Review
fix for the warning (870 bytes, patch)
2017-05-04 11:00 UTC, Vincent Penquerc'h
rejected Details | Review

Description Victor Toso 2017-05-03 06:23:50 UTC
jmspeex_:
- Hey, I'm not sure whether this is a problem with totem or whatever backend it    uses, but I have a perfectly audio valid file that crashes totem
- https://jmvalin.ca/misc_stuff/totem_crash2.opus
- This particular file is a chained Opus file, but even without chains, any file with a preskip value larger than one frame causes a crash

I reproduce it with totem 3.24, gstreamer* 1.11.91

Backtrace
Thread 1 "totem" received signal SIGSEGV, Segmentation fault.
demuxer_source_pad_probe (pad=pad@entry=0x7fffa4007030, info=info@entry=0x7fffffff9ca0, user_data=0x55555646f280) at gstdecodebin2.c:2013
2013	  if (parent_chain->active_group == group)
  • #0 demuxer_source_pad_probe
    at gstdecodebin2.c line 2013
  • #1 probe_hook_marshal
    at gstpad.c line 3469
  • #2 g_hook_list_marshal
  • #3 do_probe_callbacks
    at gstpad.c line 3621
  • #4 gst_pad_push_event_unchecked
    at gstpad.c line 5238
  • #5 gst_pad_push_event
    at gstpad.c line 5401
  • #6 gst_ogg_demux_perform_seek_pull
    at gstoggdemux.c line 3508
  • #7 gst_ogg_demux_perform_seek
    at gstoggdemux.c line 3932
  • #8 gst_ogg_pad_event
    at gstoggdemux.c line 435
  • #9 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #10 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #11 gst_pad_push_event
    at gstpad.c line 5401
  • #12 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #13 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #14 gst_pad_push_event
    at gstpad.c line 5401
  • #15 gst_audio_decoder_src_eventfunc
    at gstaudiodecoder.c line 2428
  • #16 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #17 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #18 gst_pad_push_event
    at gstpad.c line 5401
  • #19 event_forward_func
    at gstpad.c line 2992
  • #20 gst_pad_forward
    at gstpad.c line 2946
  • #21 gst_pad_event_default
    at gstpad.c line 3043
  • #22 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #23 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #24 gst_pad_push_event
    at gstpad.c line 5401
  • #25 event_forward_func
    at gstpad.c line 2992
  • #26 gst_pad_forward
    at gstpad.c line 2946
  • #27 gst_pad_event_default
    at gstpad.c line 3043
  • #28 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #29 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #30 gst_pad_push_event
    at gstpad.c line 5401
  • #31 gst_input_selector_event
    at gstinputselector.c line 1546
  • #32 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #33 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #34 gst_pad_push_event
    at gstpad.c line 5401
  • #35 event_forward_func
    at gstpad.c line 2992
  • #36 gst_pad_forward
    at gstpad.c line 2946
  • #37 gst_pad_event_default
    at gstpad.c line 3043
  • #38 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #39 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #40 gst_pad_push_event
    at gstpad.c line 5401
  • #41 event_forward_func
    at gstpad.c line 2992
  • #42 gst_pad_forward
    at gstpad.c line 2946
  • #43 gst_pad_event_default
    at gstpad.c line 3043
  • #44 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #45 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #46 gst_pad_push_event
    at gstpad.c line 5401
  • #47 event_forward_func
    at gstpad.c line 2992
  • #48 gst_pad_forward
    at gstpad.c line 2946
  • #49 gst_pad_event_default
    at gstpad.c line 3043
  • #50 gst_stream_synchronizer_src_event
    at gststreamsynchronizer.c line 204
  • #51 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #52 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #53 gst_pad_push_event
    at gstpad.c line 5401
  • #54 event_forward_func
    at gstpad.c line 2992
  • #55 gst_pad_forward
    at gstpad.c line 2946
  • #56 gst_pad_event_default
    at gstpad.c line 3043
  • #57 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #58 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #59 gst_pad_push_event
    at gstpad.c line 5401
  • #60 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1948
  • #61 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #62 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #63 gst_pad_push_event
    at gstpad.c line 5401
  • #64 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1948
  • #65 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #66 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #67 gst_pad_push_event
    at gstpad.c line 5401
  • #68 event_forward_func
    at gstpad.c line 2992
  • #69 gst_pad_forward
    at gstpad.c line 2946
  • #70 gst_pad_event_default
    at gstpad.c line 3043
  • #71 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #72 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #73 gst_pad_push_event
    at gstpad.c line 5401
  • #74 event_forward_func
    at gstpad.c line 2992
  • #75 gst_pad_forward
    at gstpad.c line 2946
  • #76 gst_pad_event_default
    at gstpad.c line 3043
  • #77 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #78 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #79 gst_pad_push_event
    at gstpad.c line 5401
  • #80 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1948
  • #81 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #82 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #83 gst_pad_push_event
    at gstpad.c line 5401
  • #84 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1948
  • #85 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #86 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #87 gst_pad_push_event
    at gstpad.c line 5401
  • #88 event_forward_func
    at gstpad.c line 2992
  • #89 gst_pad_forward
    at gstpad.c line 2946
  • #90 gst_pad_event_default
    at gstpad.c line 3043
  • #91 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #92 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #93 gst_pad_push_event
    at gstpad.c line 5401
  • #94 event_forward_func
    at gstpad.c line 2992
  • #95 gst_pad_forward
    at gstpad.c line 2946
  • #96 gst_pad_event_default
    at gstpad.c line 3043
  • #97 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #98 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #99 gst_pad_push_event
    at gstpad.c line 5401
  • #100 gst_base_transform_src_eventfunc
    at gstbasetransform.c line 1948
  • #101 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #102 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #103 gst_pad_push_event
    at gstpad.c line 5401
  • #104 event_forward_func
    at gstpad.c line 2992
  • #105 gst_pad_forward
    at gstpad.c line 2946
  • #106 gst_pad_event_default
    at gstpad.c line 3043
  • #107 gst_pad_send_event_unchecked
    at gstpad.c line 5608
  • #108 gst_pad_push_event_unchecked
    at gstpad.c line 5264
  • #109 gst_pad_push_event
    at gstpad.c line 5401
  • #110 gst_base_sink_send_event
    at gstbasesink.c line 4513
  • #111 gst_element_send_event
    at gstelement.c line 1650
  • #112 gst_bin_send_event
    at gstbin.c line 3134
  • #113 gst_element_send_event
    at gstelement.c line 1650
  • #114 gst_bin_send_event
    at gstbin.c line 3134
  • #115 gst_element_send_event
    at gstelement.c line 1650
  • #116 gst_bin_send_event
    at gstbin.c line 3134
  • #117 gst_element_send_event
    at gstelement.c line 1650
  • #118 gst_play_sink_send_event_to_sink
    at gstplaysink.c line 4756
  • #119 gst_play_sink_send_event_to_sink
    at gstplaysink.c line 4733
  • #120 gst_play_sink_send_event
    at gstplaysink.c line 4790
  • #121 gst_element_send_event
    at gstelement.c line 1650
  • #122 gst_element_send_event
    at gstelement.c line 1650
  • #123 bacon_video_widget_seek_time_no_lock.isra
  • #124 bacon_video_widget_seek_time
  • #125 totem_seek_time_rel
  • #126 on_eos_event
  • #127 g_closure_invoke
  • #128 signal_emit_unlocked_R
  • #129 g_signal_emit_valist
  • #130 g_signal_emit
  • #131 bvw_signal_eos_delayed
  • #132 g_idle_dispatch
  • #133 g_main_context_dispatch
  • #134 g_main_context_iterate.isra
  • #135 g_main_context_iteration
  • #136 g_application_run
  • #137 main

Comment 1 Tim-Philipp Müller 2017-05-03 09:59:40 UTC
I can reproduce this (in totem, not in gst-play).

It should never crash of course, even if it's not a valid file.
Comment 2 Vincent Penquerc'h 2017-05-03 15:04:43 UTC
Created attachment 350990 [details] [review]
fix user after free

This fixed the crash. I still see a glib warning about adding an inactive pad though, not quite sure where that's from yet.
Comment 3 Vincent Penquerc'h 2017-05-03 16:41:24 UTC
Pushed, I'll leave this open as I'll get back to debug the cause of the warning soon.

commit b97cbe678f2cf21777295c0d6ac050ca4b183336
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed May 3 16:02:19 2017 +0100

    decodebin2: fix use after free from demuxer flush pad probe
    
    In some cases, we could get a flush-stop event after the chain structure
    containing the demuxer was freed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782095
Comment 4 Jean-Marc Valin 2017-05-03 19:25:10 UTC
Note that I just filed this related bug:
https://bugzilla.gnome.org/show_bug.cgi?id=782132
One thing I forgot to mention is that the file mentioned in this bug report should play for 90 seconds. If it only plays for one second, then it means it's never playing the other streams in the chain.
Comment 5 Vincent Penquerc'h 2017-05-04 11:00:35 UTC
Created attachment 351041 [details] [review]
fix for the warning

This seems correct, assuming I got the semantics of the NEED_PARENT flag, I'd never seen it before.
Re-adding a pad after removing it would fail to activate the pad, as it was then in "need parent" mode, whereas it wasn't on the first addition.

I'll add a separate bug for the chained opus bug, as it only plays what seems to be the first chain.
Comment 6 Sebastian Dröge (slomo) 2017-05-08 14:21:23 UTC
Review of attachment 351041 [details] [review]:

::: gst/gstelement.c
@@ +828,3 @@
   GST_TRACER_ELEMENT_REMOVE_PAD (element, pad);
   gst_object_unparent (GST_OBJECT_CAST (pad));
+  GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_NEED_PARENT);

Not sure if this is ok: the reason for that flag is to guarantee that the pad functions are only ever called with the parent!=NULL, so that you don't get any spurious calls with parent==NULL when the pad is just removed from the element.

So this would be exactly the case here...
Comment 7 Vincent Penquerc'h 2017-05-09 09:41:57 UTC
OK, then gst_pad_set_active should not check the flag then, since the pad is supposed to be set to active before being added I think. Would such a patch instead be OK ?
Comment 8 Olivier Crête 2017-05-09 12:40:36 UTC
Or maybe just have whoever re-adds a pad should unset it before doing so. It seems like a strange behaviour to remove and re-add a pad.
Comment 9 Vincent Penquerc'h 2017-05-09 14:40:32 UTC
I don't get the warning if I revert that patch on master. Tempting to just obsolete the patch...
Comment 10 Vincent Penquerc'h 2017-06-05 12:13:50 UTC
Comment on attachment 351041 [details] [review]
fix for the warning

The warning doesn't happen after the oggdemux/opusdec fix.