GNOME Bugzilla – Bug 357185
GstController binding crashes on bad arguments
Last modified: 2006-12-17 18:44:40 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):
+ Trace 72984
>>> 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 :-)
Created attachment 73208 [details] [review] Fix attempt.
2006-09-22 Edward Hervey <edward@fluendo.com> Patch by: Rene Stadler <mail@renestadler.de> * gst/gstlibs.override: Fixes for GstController creation memleak fixes.
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.
Mid-air collision with myself cleared the bug dependency again, sorry for the spam.