[gstreamer-bugs] [Bug 454259] New: Requestable Pad Segfaults When No Name Is Supplied

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Fri Jul 6 06:06:40 PDT 2007


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=454259

  GStreamer | gst-python | Ver: 0.10.6
           Summary: Requestable Pad Segfaults When No Name Is Supplied
           Product: GStreamer
           Version: 0.10.6
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
          Severity: critical
          Priority: Normal
         Component: gst-python
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: spam at coreyo.net
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: 2.17/2.18
   GNOME milestone: Unspecified


Steps to reproduce:
#!/usr/bin/env python

import pygst
pygst.require('0.10')
import gst
import sys
import gobject
gobject.threads_init()

class PyTee(gst.Element):

  __gstdetails__ = ('Tee Plugin',
                    "tee",
                    "Simple Tee Plugin",
                    "Corey O.")

  _srcpadtemplate = gst.PadTemplate ("src%d",
                                     gst.PAD_SRC,
                                     gst.PAD_REQUEST,
                                     gst.caps_new_any())

  _sinkpadtemplate = gst.PadTemplate ("sink",
                                      gst.PAD_SINK,
                                      gst.PAD_ALWAYS,
                                      gst.caps_new_any())

  __gsttemplates__ = (_srcpadtemplate, _sinkpadtemplate)

  def __init__(self):
    gst.Element.__init__(self)
    self.src_pad_count = 0
    self.src_pads = []

    self.sinkpad = gst.Pad(self._sinkpadtemplate)
    self.add_pad(self.sinkpad)

    self.sinkpad.set_chain_function(self.chainfunc)
    self.sinkpad.set_event_function(self.eventfunc)

  def do_request_new_pad(self, template, name=None):
    name = "src%d" % self.src_pad_count
    self.src_pad_count += 1
    pad = gst.Pad(template, name)
    self.src_pads.append(pad)
    self.add_pad(pad)
    return pad

  def do_release_pad(self, pad):
    self.src_pads.pop(self.src_pads.index(pad))
    self.remove_pad(pad)

  def chainfunc(self, pad, buffer):
    if len(self.src_pads) == 0:
      return gst.FLOW_NOT_LINKED
    else:
      for pad in self.src_pads:
        status = pad.push(buffer)
        if status != gst.FLOW_OK:
          return status
      return gst.FLOW_OK

  def eventfunc(self, pad, event):
    for srcpad in self.src_pads:
      status = srcpad.push_event(event)
    return status

gobject.type_register(PyTee)
gst.element_register(PyTee, 'pytee')

def on_message(bus, message):
  type = message.type
  if type == gst.MESSAGE_ERROR:
    err, debug = message.parse_error()
    print 'MESSAGE_ERROR =', err
    print 'MESSAGE_DEBUG =', debug

def main(args):
  # NOTE: the following two pipelines work properly
  #pipeline = gst.parse_launch ("fakesrc ! pytee name=tee .src0 ! fakesink")
  #pipeline = gst.parse_launch ("fakesrc ! pytee name=tee .src0 ! queue !
fakesink tee.src1 ! queue ! fakesink")
  # this pipeline causes a segfault
  pipeline = gst.parse_launch ("fakesrc ! pytee name=tee ! fakesink")
  bus = pipeline.get_bus()
  bus.add_signal_watch()
  bus.connect('message', on_message)
  pipeline.set_state(gst.STATE_PLAYING)
  try:
    gobject.MainLoop().run()
  except KeyboardInterrupt:
    pipeline.set_state(gst.STATE_NULL)
    return 0
  return -1

if __name__ == '__main__':
  sys.exit(main(sys.argv))

Stack trace:
gdb --args python requesttest.py
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) run
Starting program: /usr/bin/python requesttest.py
[Thread debugging using libthread_db enabled]
[New Thread -1209837360 (LWP 12926)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209837360 (LWP 12926)]
0xb7ea3c23 in strlen () from /lib/tls/i686/cmov/libc.so.6
(gdb) tb
Breakpoint 1 at 0xb7ea3c23
(gdb) quit
The program is running.  Exit anyway? (y or n) y

Other information:
The above script segfaults every time before much of the python code is ever
run.  The first two commented pipelines work just fine (when names are
supplied), but the third, uncommented one (with no pad names) segfaults.

obviously, there's a problem translating NULL


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=454259.




More information about the Gstreamer-bugs mailing list