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

Tomas Härdin tomas.hardin
Tue Jan 12 16:26:03 CET 2010


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.

/Tomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: avienc.diff
Type: text/x-patch
Size: 586 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100112/c84b459c/attachment.bin>



More information about the ffmpeg-devel mailing list