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

Filip Roséen filip at atch.se
Mon Feb 20 18:23:23 CET 2017


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. At least I have not stumbled across any such
guarantee when spending time with the ISO C Standards (I would however
be happy to be corrected).

The guarantees related to padding within a `struct` are available  in
`6.7.2.1/15` of `N1570` (the contents is the same for the official ISO
document (which I cannot remember the *N-number* for at the top of my
head).
 
> (So yes, there is a bug, but the fix should be much more trivial.)

I think the current fix is trivial enough, especially given what was
stated in the previous section.

Best Regards,\
Filip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170220/a660fff7/attachment.html>


More information about the vlc-devel mailing list