ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Sun 
Jul 19 18:17:18 2015 +0200| [ea8785cedae21b312e18a0bc9cb5ebcd3462cc6b] | 
committer: Michael Niedermayer

avcodec/utils: Check that channel count is valid in avcodec_open2();

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ea8785cedae21b312e18a0bc9cb5ebcd3462cc6b
---

 libavcodec/utils.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e4eb772..53b01b0 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1617,6 +1617,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
         } else if (avctx->channel_layout) {
             avctx->channels = 
av_get_channel_layout_nb_channels(avctx->channel_layout);
         }
+        if (avctx->channels < 0) {
+            av_log(avctx, AV_LOG_ERROR, "Specified number of channels %d is 
not supported\n",
+                    avctx->channels);
+            ret = AVERROR(EINVAL);
+            goto free_and_end;
+        }
         if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
             if (avctx->width <= 0 || avctx->height <= 0) {
                 av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to