[FFmpeg-cvslog] r16180 - trunk/libavcodec/aac_parser.c

Uoti Urpala uoti.urpala
Thu Dec 18 19:54:58 CET 2008


On Wed, 2008-12-17 at 03:30 +0100, mru wrote:
> AAC: fix strict aliasing violation in parser

> +++ trunk/libavcodec/aac_parser.c	Wed Dec 17 03:30:22 2008
> @@ -32,10 +32,13 @@ static int aac_sync(uint64_t state, AACA
>  {
>      GetBitContext bits;
>      int size, rdb, ch, sr;
> -    uint8_t tmp[8];
> +    union {
> +        uint64_t u64;
> +        uint8_t  u8[8];
> +    } tmp;
>  
> -    AV_WB64(tmp, state);
> -    init_get_bits(&bits, tmp+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
> +    tmp.u64 = be2me_64(state);
> +    init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);

As described in
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-December/057619.html
this does not fix the strict aliasing violation even if it does happen
to compile with current GCC. The GCC documentation of strict-aliasing
says quite explicitly that using pointers to union members like this
patch still does with bitstream is not supported. The method described
in the above mail is a better fix.





More information about the ffmpeg-cvslog mailing list