[FFmpeg-devel] Fix coredump when writing trailer to file with no streams added

Art Clarke aclarke
Thu Jun 19 19:40:06 CEST 2008

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

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.


- Art
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080619/1c1049ed/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FfmpegWriteFlvTrailerBug.c
Type: text/x-csrc
Size: 1512 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080619/1c1049ed/attachment.c>

More information about the ffmpeg-devel mailing list