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 459204 - [PATCH] [playbin] gst_play_base_bin_get_streaminfo_value_array should not return NULL
[PATCH] [playbin] gst_play_base_bin_get_streaminfo_value_array should not ret...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.x
Other Linux
: Normal normal
: 0.10.14
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-07-22 04:13 UTC by Dan Williams
Modified: 2007-07-23 11:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dan Williams 2007-07-22 04:13:22 UTC
The python code that trigged the segfault was:

        elif t == gst.MESSAGE_STATE_CHANGED:
            old, new, pen = message.parse_state_changed()
            if old == gst.STATE_READY and (new == gst.STATE_PAUSED or new == gst.STATE_PLAYING):
                print self.player.props.stream_info_value_array

The problem is that get_active_group() in the playbin returns NULL at some points.  That causes array to be NULL, which causes the boxed value to be NULL, which causes pygobject to dereferences the returned value because it's expecting an array.  Arguably pygobject should be more robust, but my look through the glib code looks like NULL shouldn't be passed to g_value_take_boxed()


static GValueArray *
gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin)
{
  GstPlayBaseGroup *group;
  GValueArray *array = NULL;

  GROUP_LOCK (play_base_bin);
  group = get_active_group (play_base_bin);
  if (group) {
    array = g_value_array_copy (group->streaminfo_value_array);
-  }
+  } else {
+    array = g_value_array_new (0);
+  }
  GROUP_UNLOCK (play_base_bin);

  return array;
}

I don't think this will leak because the GValue takes ownership of the array anyway.  Plus, it's a GValueArray, and an empty GValueArray is actually an allocated array with 0 elements, not a NULL.
Comment 1 Wim Taymans 2007-07-23 11:24:54 UTC
        Patch by: Dan Williams <dcbw at redhat dot com>

        * gst/playback/gstplaybasebin.c:
        (gst_play_base_bin_get_streaminfo_value_array):
        Don't return NULL when querying the stream info value array but instead
        return an empty array. Fixes #459204.