GNOME Bugzilla – Bug 704801
Segfault in gst_value_deserialize
Last modified: 2013-08-01 05:31:28 UTC
The following Python script segfaults in gst_value_deserialize ``` import gi gi.require_version('Gst', '1.0') from gi.repository import Gst kaps = Gst.structure_from_string('video/x-raw,framerate=(fraction)10/1') print kaps[0].get_value('rate') kaps = Gst.structure_from_string('video/x-raw,format=AYUV,framerate=\(fraction\)10/1,width=100,height=100') print kaps[0].get_value('rate') ``` ``` $ gdb python GNU gdb (GDB) 7.6-gg12 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux". <http://wiki/Main/GnuDebugger FAQ: http://go/gdb Email: gdb-team IRC: gdb> Reading symbols from /usr/bin/python2.7...done. WARNING: no debugging symbols found in /usr/bin/python2.7. Either the binary was compiled without debugging information or the debugging information was removed (e.g., with strip or strip -g). Debugger capabilities will be very limited. For further information: http://wiki/Main/GdbFaq#No_debugging_symbols_found (gdb) run test.py Starting program: /usr/bin/python2.7 test.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/grte/v3/lib64/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff34f323f in gst_value_deserialize (dest=0x7fffffffd3d8, src=0xb513c0 "10/1") at gstvalue.c:5024 5024 len = gst_value_table->len; (gdb) bt
+ Trace 232291
``` Lastest commit ``` commit bfb68443994895a357222c1c11e0625e460dd864 Author: Sebastian Dröge <slomo@circular-chaos.org> Date: Wed Jul 24 11:21:27 2013 +0200 basesink: Don't shadow variables that are set inside our scope and then used outside our scope Fixes uninitialized use of these variables. ```
Problem line is len = gst_value_table->len; Looks like gst_value_table is null? (gdb) p src $1 = (const gchar *) 0xb513c0 "10/1" (gdb) p dest $2 = (GValue *) 0x7fffffffd3d8 (gdb) p *dest $3 = {g_type = 196, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 1, v_uint = 1, v_long = 1, v_ulong = 1, v_int64 = 1, v_uint64 = 1, v_float = 1.40129846e-45, v_double = 4.9406564584124654e-324, v_pointer = 0x1}}} (gdb) p gst_value_table $4 = (GArray *) 0x0
You need to initialize GStreamer before using it. Gst.init(None)
Moving to the gst-python module. Not calling Gst.init before calling gstreamer functions causes Python to segfault. A module should never cause Python to segfault.