[FFmpeg-devel] [PATCH 1/3] nutdec: initialize has_keyframe[0]

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat May 23 10:40:42 CEST 2015


On 23.05.2015 00:42, Michael Niedermayer wrote:
> On Fri, May 22, 2015 at 11:36:17PM +0200, Andreas Cadhalpun wrote:
>> If x is 2 it is not initialized before it is used.
>>
>> This fixes 'Conditional jump or move depends on uninitialised value(s)'
>> valgrind warnings.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>>  libavformat/nutdec.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
>> index f1cece8..935adea 100644
>> --- a/libavformat/nutdec.c
>> +++ b/libavformat/nutdec.c
>> @@ -690,6 +690,7 @@ static int find_and_decode_index(NUTContext *nut)
>>      GET_V(syncpoint_count, tmp < INT_MAX / 8 && tmp > 0);
>>      syncpoints   = av_malloc_array(syncpoint_count, sizeof(int64_t));
>>      has_keyframe = av_malloc_array(syncpoint_count + 1, sizeof(int8_t));
>> +    has_keyframe[0] = 0;
> 
> ive added a check for x, this should fix it

Yes, that fixes it.

> btw above also might segfault as its before the NULL check

Right...

Best regards,
Andreas


More information about the ffmpeg-devel mailing list