[vlc-devel] [RFC] demux/xa: Open: fix xa-header parsing

Rémi Denis-Courmont remi at remlab.net
Mon Feb 20 19:18:16 CET 2017


Le maanantaina 20. helmikuuta 2017, 18.23.23 EET Filip Roséen a écrit :
> Hi Rémi,
> 
> On 2017-02-20 18:45, Rémi Denis-Courmont wrote:
> > Le maanantaina 20. helmikuuta 2017, 15.06.59 EET Filip Roséen a écrit :
> > > If a compiler introduce padding between the members of struct
> > > xa_header, the previous way of interpreting the incoming stream will
> > > yield unexpected behavior.
> > 
> > I do not see how a comforming C compiler could introduce padding anywhere
> > except at the end of the structure - since all types are aligned on their
> > natural boundary.
> 
> There is nothing to prevent a comforming compiler to not introduce
> padding even though the relevant *data-members* are aligned to their
> natural boundary.

All the non-atomic (non-vector) integer types used by VLC are explicitly 
banned from having padding bits. Arrays are required to be contiguous. 
Structures can of course have internal padding... based on the alignment 
requirements of the member types.

So I don´t see how what you describe is even theoretically possible, unless 
you take a very liberal interpretation of the specification.

And in any case, everthing breaks if this were not true, so nobody in their 
right mind would define such an ABI. XCB is heavily dependent on this for 
instance.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list