[FFmpeg-devel] [PATCH 2/8] ffmdec: check codec pointer before use

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Mon Mar 9 12:36:16 CET 2015


On 09.03.2015 04:56, Michael Niedermayer wrote:
> On Mon, Mar 09, 2015 at 12:03:11AM +0100, Andreas Cadhalpun wrote:
>> Hi,
>>
>> attached patch fixes potential crashes.
>>
>> Best regards,
>> Andreas
>
>>   ffmdec.c |   12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>> fa490a9bc11b6c8748f707fabf79d28de237ef30  0002-ffmdec-check-codec-pointer-before-use.patch
>>  From 011296153f6e0e0112803474c41c4afa840a1e6d Mon Sep 17 00:00:00 2001
>> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> Date: Sun, 8 Mar 2015 23:07:25 +0100
>> Subject: [PATCH 2/8] ffmdec: check codec pointer before use
>>
>> It is only set in the COMM case of the switch statement, but that is not
>> guaranteed to come before the others.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>>   libavformat/ffmdec.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
>> index 280a24c..af37e74 100644
>> --- a/libavformat/ffmdec.c
>> +++ b/libavformat/ffmdec.c
>> @@ -259,7 +259,7 @@ static int ffm2_read_header(AVFormatContext *s)
>>       FFMContext *ffm = s->priv_data;
>>       AVStream *st;
>>       AVIOContext *pb = s->pb;
>> -    AVCodecContext *codec;
>> +    AVCodecContext *codec = NULL;
>>       int ret;
>>       int f_main = 0, f_cprv = -1, f_stvi = -1, f_stau = -1;
>>       AVCodec *enc;
>
> ok
>
> arent the other checks redundant though ?
> as the "counters" would be -1 if codec hasnt been allocated

You're right, this is completely redundant. Patch dropped.

Best regards,
Andreas



More information about the ffmpeg-devel mailing list