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 566903 - gst.Pad.iterate_internal_links may raise critical warning or segfault
gst.Pad.iterate_internal_links may raise critical warning or segfault
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
0.10.13
Other Linux
: Normal normal
: 0.10.14
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-01-07 14:45 UTC by Mark Nauwelaerts
Modified: 2009-01-08 12:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch if it was to be fixed in gst-python (1.35 KB, patch)
2009-01-07 15:06 UTC, Edward Hervey
committed Details | Review

Description Mark Nauwelaerts 2009-01-07 14:45:24 UTC
Core gst_pad_iterate_internal_links() might return NULL rather than an actual iterator, e.g. if the pad has no parent or not an Element as parent (e.g. in ghostpad/proxypad setting), which pygst_iterator_new and friends do not seem to appreciate.

An interactive session can reproduce as exampled below
(if debug GST_PADS >= 4 segfault occurs).

As to a fix; maybe core should not return NULL, but an empty list/iterator, or pygst should come up with an "empty" one, or throw exception, or ... ? 



Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gst
>>> p = gst.Pad('p', gst.PAD_SRC)
>>> it = p.iterate_internal_links()
>>> it.next()

(.:20394): GStreamer-CRITICAL **: gst_iterator_next: assertion `it != NULL' failed
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
TypeError: Error
>>> quit()

(.:20394): GStreamer-CRITICAL **: gst_iterator_free: assertion `it != NULL' failed
Comment 1 Edward Hervey 2009-01-07 15:06:29 UTC
Created attachment 125932 [details] [review]
Patch if it was to be fixed in gst-python

If this issue was to be fixed, here's a proposal patch to make gst-python's GstIterator constructors raise an exception if the GstIterator is NULL.

Minimalistic unit test along with it.
Comment 2 Edward Hervey 2009-01-08 10:20:28 UTC
Do we want this in for the upcoming release ?
Comment 3 Jan Schmidt 2009-01-08 11:56:33 UTC
Seems like a sensible thing to have to me. I'm also for the idea that the core should be consistent in what it returns (an empty iterator when needed), rather than NULL.
Comment 4 Edward Hervey 2009-01-08 12:03:54 UTC
Marking as blocker, and waiting for blessing from the Archbishop of the church of All That Starts In V.
Comment 5 Edward Hervey 2009-01-08 12:25:51 UTC
2009-01-08  Edward Hervey  <edward.hervey@collabora.co.uk>

	* gst/pygstiterator.c: (pygst_iterator_new):
	* testsuite/test_iterator.py:
	Raise an Exception when wrapping a NULL GstIterator.
	Fixes #566903