dbus glib string array errors

Havoc Pennington hp at redhat.com
Thu Aug 24 12:10:49 PDT 2006



keith preston wrote:
> I am trying to send some arrays across DBUS with glib bindings and get 
> an error and segfault when I send empty string array.  I believe it 
> should gracefully handle this case.  It does seem to handle empty 
> GArrays, but not string arrays.
> 
> I send the following:
> 'as'  array of string glib bindings show this as a char** so I am 
> assuming I need to null terminate this array
> char** arraystrings = malloc(sizeof(char*) * (sizeofarray +1) )
> arraystrings[sizeofarray] = NULL;
> 
> 
> If I do this with empty arrays (sizeofarray = 0).  My server process 
> answering the dbus request segfaults with the following error
> 
> 27088: arguments to dbus_message_iter_get_fixed_array() were incorrect, 
> assertion "dbus_type_is_fixed (_dbus_type_reader_get_current_type 
> (&real-> u.reader))" failed in file dbus-message.c line 1741.
> 
> If I change the code to give it one element it works great.  But it 
> always fails with zero.

In CVS it looks like there's a fix where this assertion will no longer 
fail on empty arrays.

However, it will still fail on string arrays because strings are not 
fixed-size types. You can't use dbus_message_iter_get_fixed_array on 
string arrays.

Havoc


More information about the dbus mailing list