[FFmpeg-devel] [PATCH v6 4/4] lavf/utils: Normalize AVPacket.data to native endian

Mats Peterson matsp888 at yahoo.com
Fri Mar 4 03:41:23 CET 2016


On 03/04/2016 03:30 AM, Michael Niedermayer wrote:
>>
>> -    if (!*palette && ret == CONTAINS_PAL)
>> -        *palette = pkt->data + pkt->size - AVPALETTE_SIZE;
>> +    if (!*palette && ret == CONTAINS_PAL) {
>> +        uint8_t *pkt_pal = pkt->data + pkt->size - AVPALETTE_SIZE;
>> +        int i;
>> +        for (i = 0; i < AVPALETTE_COUNT; i++) {
>> +            uint8_t *p8 = pkt_pal + 4*i;
>
>> +            uint32_t *p32 = (uint32_t *)p8;
>
> undefined behavior, violating alignment requirements, and possibly
> aliassing violation
>

Really? It works just fine, so please elaborate.

>
>> +            *p32 = AV_RL32(p8);
>
> corrupting potenially shared or read only input packet
>
> [...]

That one I do understand.



More information about the ffmpeg-devel mailing list