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 162924 - [playbin] totem assertion failures when playing cd / potential crash due to accessing freed memory
[playbin] totem assertion failures when playing cd / potential crash due to a...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other Linux
: Normal blocker
: 0.8.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-01-04 15:55 UTC by Tim-Philipp Müller
Modified: 2005-01-05 14:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (668 bytes, patch)
2005-01-04 15:58 UTC, Tim-Philipp Müller
none Details | Review
better patch (787 bytes, patch)
2005-01-04 16:22 UTC, Tim-Philipp Müller
committed Details | Review

Description Tim-Philipp Müller 2005-01-04 15:55:04 UTC
This code in gstplaybasebin.c  
 
       structure = gst_caps_get_structure (caps, 0); 
       gst_caps_free (caps); 
       mimetype = gst_structure_get_name (structure); 
 
       if (g_str_has_prefix (mimetype, "audio/x-raw")  
         ..... 
 
causes assertion failures like 
 
 GLib-CRITICAL **: file gstrfuncs.c: line 2660 (g_str_has_prefix): assertion 
`str != NULL' failed 
 
in totem, e.g. when trying to play back a CD. This is the same that Stephane 
Loeuillet mentioned earlier in bug #162913, and a potential crasher. 
 
The problem is that the returned GstStructure belongs to the caps and is freed 
with the caps when they are freed; gst_structure_get_name (structure) then 
accesses already freed memory. 
 
Patch attached. 
 
Cheers 
 -Tim
Comment 1 Tim-Philipp Müller 2005-01-04 15:58:17 UTC
Created attachment 35434 [details] [review]
patch
Comment 2 Tim-Philipp Müller 2005-01-04 16:22:02 UTC
Created attachment 35436 [details] [review]
better patch

Don't make assumptions about implementation details of GstStructure (ie that
the name is backed up by GQuarks and thus the const string valid after the
structure is freed).

Cheers
 -Tim
Comment 3 Thomas Vander Stichele 2005-01-05 10:12:48 UTC
commited, thanks