[FFmpeg-devel] [PATCH] add check for invalid number of channels for ts (issue 2505)

Justin Ruggles justin.ruggles
Sat Jan 8 21:38:16 CET 2011

On 01/08/2011 02:20 PM, Daniel Kang wrote:

> On Fri, Jan 7, 2011 at 8:03 AM, Daniel Kang <daniel.d.kang at gmail.com> wrote:
>> For ts files with an invalid number of channels, ffmpeg crashes with a
>> buffer overread. The patch attached adds a check for an invalid number
>> of channels.
> Thanks to Benjamin Larsson, I have updated the patch to fix this issue
> in a better way.

> +    if (avctx->channels != channels) {
> +        av_log(avctx, AV_LOG_ERROR, "ffmpeg does not support number of channels changing in stream. Skipping frame.\n");
> +        return -1;
> +    }

This is not a true statement unless you're referring to ffmpeg the
application, not FFmpeg in general.  If you're referring to the
application, that should not be a reason to do something in libavcodec.
 For example, the AC3 decoder can handle the number of channels changing
mid-stream in some cases.  Maybe this should just say that the DCA
decoder does not support the number of channels changing mid-stream.


More information about the ffmpeg-devel mailing list