Clarifications on the D-Bus specification

Rémi Denis-Courmont remi at remlab.net
Fri Dec 10 10:15:21 PST 2010




On Fri, 10 Dec 2010 10:20:14 -0500, Havoc Pennington <hp at pobox.com> wrote:
> Hi,
> 
> 2010/12/9 Rémi Denis-Courmont <remi at remlab.net>:
>> 1/ Structures cannot be nested more than 32 times. Does that include
>> dictionary entries as well? Or is there no specific limit for dictionary
>> entries? (They can only be inside arrays and array nesting is limited
> anyhow)
> 
> I would think that a dict entry counts as a struct here.
> 
>           <para>
>                 The maximum depth of container type nesting is 32 array
> type
>                 codes and 32 open parentheses. This implies that the
> maximum
>                 total depth of recursion is 64, for an "array of array of
> array
>                 of ... struct of struct of struct of ..."  where there
are
> 32
>                 array and 32 struct.
>               </para>
> 
>> 2/ What is the limit on variant nesting? I cannot see any mention of
> that?!
> 
> The limits are really on one signature, so I would think each variant
> contains a new signature and thus would reset the nest limits.
> 
> Really, not sure the nesting limit is that useful since signatures are
> already limited to 255 bytes, that's effectively a cap on nesting
> already.

Isn't there a problem if a variant contains a structure of one variant
'(v)', which... countains a structure of one variant '(v)' which countains
a byte? And then iterate that thing many times. To parse the message, a
very very deep recursion will be required when iterating past the top-most
variant (without 'opening' it).

If I'm not mistaken, each variant will occupy 6 bytes. So in even 64kb, you
can fit over 10000 thousands level of recursion, can't you?

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis



More information about the dbus mailing list