GNOME Bugzilla – Bug 339287
[lame] segfault if EOS before setcaps
Last modified: 2006-04-21 12:42:10 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
+ Trace 67766
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)).
Created attachment 64036 [details] [review] lame-segfault.patch Suggested patch.
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).