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

Benoit Fouet benoit.fouet
Tue May 22 09:24:41 CEST 2007


Hi,

Glenn A. Serre wrote:
> Good evening,
>
> This patch would be to avoid a compiler warning and avoid a crash that 
> happened when I experimented with having mpegts add streams from all the 
> PMTs in the transport stream, rather than just from the first one found.
>
>   

it is better to split patches
the two ones you're proposing are not correlated, so they should be
splitted.

> Please note that I can't actually check this in (or at least I shouldn't 
>   be able to).  Also, please note that the revision number below is 
> against our repository, not the official ffmpeg one.
>
>   

but it is not against svn head, so your patch cannot be applied as is

> 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 ?)

>   #ifdef DEBUG_SI
>       av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len);
> @@ -877,7 +877,7 @@
>               }
>               if (len > 0) {
>                   AVPacket *pkt = ts->pkt;
> -                if (pes->st && av_new_packet(pkt, len) == 0) {
> +                if (pkt && pes->st && av_new_packet(pkt, len) == 0) {
>                       memcpy(pkt->data, p, len);
>                       pkt->stream_index = pes->st->index;
>                       pkt->pts = pes->pts;
>   

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




More information about the ffmpeg-devel mailing list