[FFmpeg-devel] [PATCH 1/2] avformat/mov: zero initialize codec_name in mov_parse_stsd_video()

James Almer jamrial at gmail.com
Mon Oct 17 16:37:38 EEST 2016


On 10/17/2016 10:05 AM, Benoit Fouet wrote:
> Hi,
> 
> 
> On 17/10/2016 02:34, James Almer wrote:
>> Fixes valgrind warning about "Conditional jump or move depends on uninitialised value(s)"
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavformat/mov.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index add1812..7462ecf 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -1802,7 +1802,7 @@ static int mov_codec_id(AVStream *st, uint32_t format)
>>  static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
>>                                   AVStream *st, MOVStreamContext *sc)
>>  {
>> -    uint8_t codec_name[32];
>> +    uint8_t codec_name[32] = { 0 };
>>      int64_t stsd_start;
>>      unsigned int len;
>>  
> 
> Do we really need to "fix" false positive from Valgrind?

I don't see why not. It's a one line change that zero initializes
stack and removes noise from the valgrind fate clients, making actual
memleaks and such in the future easy to notice after a quick glance.



More information about the ffmpeg-devel mailing list