[FFmpeg-devel] [PATCH] libavformat/mpegts.c minor crash and warning avoidance

Benoit Fouet benoit.fouet
Wed May 23 09:23:25 CEST 2007


Hi,

Glenn A. Serre wrote:
> Good afternoon,
>
> Benoit Fouet wrote:
>   
>> Hi,
>>
>> Baptiste Coudurier wrote:
>>     
>>> Hi
>>>
>>> Benoit Fouet wrote:
>>>   
>>>       
>>>> [...]
>>>>
>>>>     
>>>>         
>>>>> Index: libavformat/mpegts.c
>>>>> ===================================================================
>>>>> --- libavformat/mpegts.c	(revision 19)
>>>>> +++ libavformat/mpegts.c	(working copy)
>>>>> @@ -397,7 +397,7 @@
>>>>>       int program_info_length, pcr_pid, pid, stream_type;
>>>>>       int desc_list_len, desc_len, desc_tag;
>>>>>       int comp_page = 0, anc_page = 0; /* initialize to kill warnings */
>>>>> -    char language[4];
>>>>> +    char language[4] = {0}; /* initialize to kill warnings */
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>> there is no warning due to the uninitialization of language (maybe your
>>>> gcc version is too old ?)
>>>>     
>>>>         
>>> I think he refers to:
>>>
>>> mpegts.c: In function 'pmt_cb':
>>> mpegts.c:400: warning: 'language[1]' may be used uninitialized in this
>>> function
>>> mpegts.c:400: warning: 'language[2]' may be used uninitialized in this
>>> function
>>> mpegts.c:400: warning: 'language[3]' may be used uninitialized in this
>>> function
>>>   
>>>       
>> yes, surely, but:
>> 1/ i have no warning about that
>>     
>
> gcc 4.1.1 on x86 fedora emits this warning.
>
>   

ok, my gcc doesn't.
it seems, that it was *my* gcc version which was too old :)

>> 2/ by reading the code quickly, i'd say the warnings are wrong, as
>> language[0..3] are all initialized if they're read back.
>>
>>     
>
> I agree.  I don't know what the policy is in this case, but initializing 
> the array is low cost.
>
>   

i don't know, though i remember some part of code with comments like
"no, it might not be used uninitialized" or something like that...

Ben
-- 
Purple Labs S.A.
www.purplelabs.com




More information about the ffmpeg-devel mailing list