[FFmpeg-devel] Fix coredump when writing trailer to file with no streams added
Michael Niedermayer
michaelni
Thu Jun 19 21:24:02 CEST 2008
On Thu, Jun 19, 2008 at 01:40:06PM -0400, Art Clarke wrote:
> Hi there,
>
> Ffmpeg core-dumps if you do an av_write_header() and then an
> av_write_trailer() without first adding at least one stream to the output
> file.
>
> While in theory users should NEVER output a file with no streams in it,
> core-dumping seems like the wrong thing to do. The fix just checks to make
> sure there is at least one stream before we start returning cached packets
> to write.
>
> Also attached is a test case file that generates the crash before the fix,
> and shows that everything runs smoothly after the fix.
>
> Please let me know if this passes the bar for a fix, is rejected, or if in
> between, what I need to do to fix it up right.
>
> Thanks,
>
> - Art
> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c (revision 13819)
> +++ libavformat/utils.c (working copy)
> @@ -2551,7 +2551,7 @@
> pktl= pktl->next;
> }
>
> - if(s->nb_streams == stream_count || (flush && stream_count)){
> + if(stream_count && s->nb_streams == stream_count || (flush && stream_count)){
this check can be simplified
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080619/1ef87a88/attachment.pgp>
More information about the ffmpeg-devel
mailing list