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 339287 - [lame] segfault if EOS before setcaps
[lame] segfault if EOS before setcaps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
git master
Other Linux
: Normal normal
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-04-21 11:58 UTC by Ed Catmur
Modified: 2006-04-21 12:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
lame-segfault.patch (1.48 KB, patch)
2006-04-21 12:05 UTC, Ed Catmur
committed Details | Review

Description Ed Catmur 2006-04-21 11:58:58 UTC
$ GST_DEBUG=lame:5 gst-launch-0.10 filesrc location=/dev/null ! lame
DEBUG (0x80509a0 - 0:00:01.710567000)                 lame( 6909) gstlame.c(521):gst_lame_init:<GstLame@0x80e5090> starting initialization
DEBUG (0x80509a0 - 0:00:01.711124000)                 lame( 6909) gstlame.c(590):gst_lame_init:<GstLame@0x80e5090> done initializing
Setting pipeline to PAUSED ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
DEBUG (0x80e67b8 - 0:00:01.714604000)                 lame( 6909) gstlame.c(957):gst_lame_sink_event:<lame0> handling EOS event
Segmentation fault

Obviously I'd usually be feeding an actual media file in - but EOS before setcaps does happen sometimes, particularly with buggy media files.

Backtrace:
(gdb) bt
  • #0 lame_encode_flush
    at lame.c line 1825
  • #1 gst_lame_sink_event
    at gstlame.c line 959
  • #2 gst_pad_send_event
    at gstpad.c line 3731
  • #3 gst_pad_push_event
    at gstpad.c line 3597

static gboolean
gst_lame_sink_event (GstPad * pad, GstEvent * event)
{
  gboolean ret;
  GstLame *lame;

  lame = GST_LAME (gst_pad_get_parent (pad));

  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_EOS:{
      GstBuffer *buf;
      gint size;

      GST_DEBUG_OBJECT (lame, "handling EOS event");
      buf = gst_buffer_new_and_alloc (7200);
      size = lame_encode_flush (lame->lgf, GST_BUFFER_DATA (buf), 7200);

Because setcaps has not yet run, lame->lgf is NULL.

Suggested fix: wrap ll 954-968 in if (G_LIKELY(lame->lgf != NULL)).
Comment 1 Ed Catmur 2006-04-21 12:05:26 UTC
Created attachment 64036 [details] [review]
lame-segfault.patch

Suggested patch.
Comment 2 Tim-Philipp Müller 2006-04-21 12:42:10 UTC
Thanks, applied:

 2006-04-21  Tim-Philipp Müller  <tim at centricular dot net>

       Patch by: Ed Catmur  <ed at catmur dot co dot uk>

       * ext/lame/gstlame.c: (gst_lame_sink_event):
         Don't crash if we get an EOS event before the encoder
         has been set up (#339287).