[FFmpeg-devel] [PATCH] ac3_parser type punning fix

Janne Grunau janne-ffmpeg
Wed Oct 29 00:24:38 CET 2008


On Sunday 19 October 2008 18:55:43 Michael Niedermayer wrote:
> > > The second reason is
> > > #define AV_RN64(a) (*((const uint64_t*)(a)))
> > > #define AV_WN64(a, b) *((uint64_t*)(a)) = (b)
> > > ...
> > > # ?define AV_RB64(x) ? ?bswap_64(AV_RN64(x))
> > > # ?define AV_WB64(p, d) AV_WN64(p, bswap_64(d))
> >
> > Please elaborate.
>
> in aac_parser a AV_WB64() (=uint64_t write) is used to write into a
> uint8_t array that is then finally read as uint32_t.
> I do not think this is allowed under strict aliasing rules.

And it miscompiles with ubuntu's gcc 4.2.4 on X86_32. The code seems to 
sufficient complex to miss strict aliasing warnings but aac_parser 
compiled with -fstrict-aliasing is broken.

Janne 




More information about the ffmpeg-devel mailing list