[FFmpeg-devel] [Patch] Fix crash in avienc when muxing zero streams

Michael Niedermayer michaelni
Tue Jan 12 23:40:43 CET 2010


On Tue, Jan 12, 2010 at 04:26:03PM +0100, Tomas H?rdin wrote:
> Good evening
> 
> I've noticed a bug in libavformat/avienc.c - avi_write_header()
> segfaults when the number of streams is zero. The culprit is line 363,
> which is missing a NULL pointer check on s->streams[0]. Zero streams
> should be semantically equal to CODEC_FLAG_BITEXACT not being set, so I
> simply prepended "!s->streams[0] ||". Some might prefer nb_streams == 0
> though.
> 
> There are more examples of this behaviour. Try searching for streams[0]
> and you'll find more (soxenc.c for instance). That's probably for
> another day though.
> 
> Attached patch passes the tests.

what use is a avi file with no streams?
none? then  the check belongs in the common code to prevent this case
from ever reaching any muxer

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- 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/20100112/f9a7f6e4/attachment.pgp>



More information about the ffmpeg-devel mailing list