[FFmpeg-devel] [PATCH] IFF: Fix IFF decoder crash with enabled avfilter

Vitor Sessak vitor1001
Wed May 26 16:29:32 CEST 2010


On 05/26/2010 04:24 PM, Ronald S. Bultje wrote:
> Hi,
>
> On Wed, May 26, 2010 at 8:31 AM, Sebastian Vater
> <cdgs.basty at googlemail.com>  wrote:
>> Ronald S. Bultje a ?crit :
>>> On Sun, May 23, 2010 at 12:41 PM, Sebastian Vater
>>> <cdgs.basty at googlemail.com>  wrote:
>>>> Finally, the IFF decoder works also with enabled libavfilter.
>>>>
>>>> I just tried out this patch with all images and they work like a charm.
>>>>
>>>> I did this by moving get_buffer call in decode_init to both decode_frame
>>>> parts (replacing the reget_buffers there).
>>>>
>>>> Also I had to move ff_read_cmap_palette from decode_init to decode_frame
>>>> also since that relies on get_buffer already called.
>>>>
>>>> So here's the very small patch to review. :)
>>>>
>>> [..]
>>>
>>>> -    if (avctx->reget_buffer(avctx,&s->frame)<  0){
>>>> +    if ((res = avctx->get_buffer(avctx,&s->frame)<  0)) {
>>>>           av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>>>> -        return -1;
>>>> +        return res;
>>>> +    } else if (avctx->bits_per_coded_sample<= 8&&  avctx->pix_fmt != PIX_FMT_GRAY8) {
>>>> +        if ((res = ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1]))<  0)
>>>> +            return res;
>>>>       }
>>>>
>>>
>>> You don't want to do this every time, right? Shouldn't there be some
>>> s->init variable or so, so you do this only once?
>>>
>>
>> Yes, you're right.
>> Fixed!
>
> Patch OK. Will apply later unless somebody beats me to it (or if
> someone complains).

Is this an actual bug of the IFF decoder? If it is a bug of lavfi, it 
should be fixed in lavfi...

-Vitor



More information about the ffmpeg-devel mailing list