[FFmpeg-devel] [PATCH] libavformat/mpegts.c minor crash and warning avoidance
Glenn A. Serre
gaserre
Wed May 23 02:29:13 CEST 2007
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.
> 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.
Thanks,
--Glenn S.
More information about the ffmpeg-devel
mailing list