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 357185 - GstController binding crashes on bad arguments
GstController binding crashes on bad arguments
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other All
: Normal normal
: 0.10.6
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 357432
Blocks:
 
 
Reported: 2006-09-22 12:31 UTC by René Stadler
Modified: 2006-12-17 18:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix attempt. (2.03 KB, patch)
2006-09-22 12:32 UTC, René Stadler
committed Details | Review

Description René Stadler 2006-09-22 12:31:22 UTC
Consider these snippets, each run with

>>> import pygst; pygst.require ("0.10"); import gst

before:

>>> gst.Controller ("spam")
Segmentation fault

>>> gst.Controller (gst.element_factory_make ("volume"), None)
Traceback (most recent call last):
  • File "<stdin>", line 1 in ?
RuntimeError: could not create GstController object

>>> gst.Controller (gst.element_factory_make ("volume"), "volume", -1)
Segmentation fault

>>> c = gst.Controller (gst.element_factory_make ("volume"), "volume")
>>> c.remove_properties (None)
Segmentation fault


After attached patch is applied, these come out as:

>>> gst.Controller ("spam")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: argument 1 must be gobject.GObject, not str

>>> gst.Controller (gst.element_factory_make ("volume"), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: expected string or Unicode object, NoneType found

>>> gst.Controller (gst.element_factory_make ("volume"), "volume", -1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: expected string or Unicode object, int found

>>> c = gst.Controller (gst.element_factory_make ("volume"), "volume")
>>> c.remove_properties (None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: expected string or Unicode object, NoneType found

A lot nicer, isn't it?  The patch also fixes leaking the GLists (though their data is _not_ leaked, the string pointer destinations are owned by python).

There are still more ways to crash, I will provide more patches later and close the bug once I'm satisfied :-)
Comment 1 René Stadler 2006-09-22 12:32:11 UTC
Created attachment 73208 [details] [review]
Fix attempt.
Comment 2 Edward Hervey 2006-09-22 13:23:01 UTC
2006-09-22  Edward Hervey  <edward@fluendo.com>

        Patch by: Rene Stadler <mail@renestadler.de>
        * gst/gstlibs.override:
        Fixes for GstController creation
        memleak fixes.

Comment 3 René Stadler 2006-10-06 17:18:59 UTC
Looks like I already got all crashers.  However, the code still leaks, gives misleading error messages and the argument conversion is flawed.  Have a patch that seems to clear all this up, but I want it backed by an addition to the test suite.  This is problematic as long as bug #357432 persists, as I need ackward wordarounds for that in the tests to not trigger warnings/crashes.  I'm thus postponing this a little: One might understand #357432 as a major blocker for being able to bind GstController to a higher-level language at all so it makes sense to wait for it being fixed.
Comment 4 René Stadler 2006-10-06 17:24:02 UTC
Mid-air collision with myself cleared the bug dependency again, sorry for the spam.