gst_value_deserialize writes to a const char* when deserializing a list
The declaration for the gst_value_deserialize
function seems to imply you can pass a constant string to it:
gboolean gst_value_deserialize (GValue *dest, const gchar *src);
However, if you try deserialize a list from a constant string, it fails because _priv_gst_value_parse_value
tries to write to it.
Example:
#include <gst/gst.h>
int main(int argc, char* argv[])
{
gst_init (&argc, &argv);
GValue value = G_VALUE_INIT;
g_value_init (&value, GST_TYPE_LIST);
gst_value_deserialize (&value, "{ hello, world }");
return 0;
}
Stack trace:
Program received signal SIGSEGV, Segmentation fault.
_priv_gst_value_parse_value (str=0x67c006 "hello, world }", after=0x7fffffffddb8, value=0x7fffffffddc0, default_type=0) at ../gst/gstvalue.c:2581
2581 *value_end = '\0';
(gdb) bt
#0 _priv_gst_value_parse_value (str=0x67c006 "hello, world }", after=0x7fffffffddb8, value=0x7fffffffddc0, default_type=0) at ../gst/gstvalue.c:2581
#1 0x00000000004aab0b in _priv_gst_value_parse_any_list (s=0x67c006 "hello, world }", after=0x7fffffffde48, value=0x7fffffffdec0, type=0, begin=123 '{', end=125 '}') at ../gst/gstvalue.c:2449
#2 0x00000000004aacc1 in _priv_gst_value_parse_list (s=0x67c004 "{ hello, world }", after=0x7fffffffde48, value=0x7fffffffdec0, type=0) at ../gst/gstvalue.c:2486
#3 0x00000000004a7df4 in gst_value_deserialize_value_list (dest=0x7fffffffdec0, s=0x67c004 "{ hello, world }") at ../gst/gstvalue.c:1095
#4 0x00000000004b3dec in gst_value_deserialize (dest=0x7fffffffdec0, src=0x67c004 "{ hello, world }") at ../gst/gstvalue.c:6158
#5 0x0000000000402350 in main (argc=1, argv=0x7fffffffe008) at /tmp/test-value.c:9
(gdb) info locals
try_types = {24, 60, 220, 228, 20, 64}
i = 32767
type_name = 0x0
type_end = 0x7fffffffde20 "P\336\377\377\377\177"
value_s = 0x67c006 "hello, world }"
value_end = 0x67c00b ", world }"
s = 0x67c00b ", world }"
c = 44 ','
ret = 0
type = 0
__func__ = "_priv_gst_value_parse_value"
I think either the string shouldn't be written to, or the function signature needs to be changed (although the latter probably has too many other downsides).