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 733982 - [Regression] Do not crash when checking whether an instance type is of a given fundamental
[Regression] Do not crash when checking whether an instance type is of a give...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-07-30 14:42 UTC by Andre Moreira Magalhaes
Modified: 2014-08-08 09:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1.24 KB, patch)
2014-07-30 14:42 UTC, Andre Moreira Magalhaes
committed Details | Review

Description Andre Moreira Magalhaes 2014-07-30 14:42:59 UTC
Created attachment 282070 [details] [review]
Patch

The issue was introduced on the commit for bug #730984. What happens is that using g_type_check_instance_is_fundamentally_a (used by G_IS_OBJECT and others) crash when passing an instance of GstEvent (and probably any other GBoxed type). The thing is that not all GType instances have a TypeNode associated.

I found the issue when using GST_DEBUG to debug an app and the crash would happen every time GST_DEBUG were used with GST_PTR_FORMAT on a GstEvent instance which in the end would call G_IS_OBJECT on the instance, causing the crash.

The crash can be easily reproduced with the following code:

  ev = gst_event_new_eos ();
  fprintf (stderr, "event is object=%d\n", G_IS_OBJECT (ev));

Fix attached.
Comment 1 Edward Hervey 2014-07-30 14:50:12 UTC
Sounds like a sane fix, avoids crashes when used with random pointer values.
Comment 2 Edward Hervey 2014-08-08 09:20:57 UTC
Pushed as:

commit 4b5bdf6cebc4c1b7c6db7e23c678cc2f5003e757
Author: Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>
Date:   Tue Jul 29 21:04:48 2014 -0300

    Do not crash when checking whether an instance type is of a given fundamental.
    
    Not all instances have a TypeNode associated (e.g. GstEvent), so lets check if node is available
    before trying to use it.
    
    This crash can be easily reproduced by creating an event with gst_event_new_eos and using
    G_IS_OBJECT on the event instance.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733982
Comment 3 Edward Hervey 2014-08-08 09:23:41 UTC
Since the initial commit was in 2.40.0, do we want to also have this fix in the 2.40 branch ?