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

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


On 03/04/2016 03:45 AM, Mats Peterson wrote:
> On 03/04/2016 03:41 AM, Mats Peterson wrote:
>> 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.
>>
>> _______________________________________________
>
> Forget this version then, and use version 5. Just as long as it gets
> applied in a foreseeable future.
>
> Mats
>
-

Use version 5 with v2 of patch 4/4.

Mats



More information about the ffmpeg-devel mailing list