[FFmpeg-devel] [PATCH 1/2] AAC: fix strict aliasing violation in parser

Alex Converse alex.converse
Sun Dec 14 22:45:37 CET 2008


On Sun, Dec 14, 2008 at 4:43 PM, Alex Converse <alex.converse at gmail.com>wrote:

> On Sun, Dec 14, 2008 at 3:53 PM, Mans Rullgard <mans at mansr.com> wrote:
>
>> ---
>>  libavcodec/aac_parser.c |    9 ++++++---
>>  1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
>> index 1d75e1e..3ff1416 100644
>> --- a/libavcodec/aac_parser.c
>> +++ b/libavcodec/aac_parser.c
>> @@ -32,10 +32,13 @@ static int aac_sync(uint64_t state, AACAC3ParseContext
>> *hdr_info,
>>  {
>>     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);
>>
>>     if(get_bits(&bits, 12) != 0xfff)
>>         return 0;
>>
>
> Is a uint8_t considered a character type? According to the spec character
> types can alias any type. The ac3_sync() in the ac3 parser seems to make
> that assumption and does not use the union.
>

Ignore the part about ac3, I missed the second patch.

Sorry,
Alex




More information about the ffmpeg-devel mailing list