aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2009-09-16 11:29:47 +0000
committerPeter Ross <pross@xvid.org>2009-09-16 11:29:47 +0000
commitfa77dd639da796b32d84bed2a00d64b2dd434707 (patch)
tree466b5e85169b44a9a7509c1d457f88c36e74d5ab /libavcodec
parent385ae7021f370ad45f76a3d41997105cfe71eb7f (diff)
downloadffmpeg-fa77dd639da796b32d84bed2a00d64b2dd434707.tar.gz
perform sanity check on number of audio channels in avcodec_open()
Originally committed as revision 19877 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 43147a5216..e22bc3302e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -471,7 +471,9 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
else if(avctx->width && avctx->height)
avcodec_set_dimensions(avctx, avctx->width, avctx->height);
- if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height)){
+#define SANE_NB_CHANNELS 128U
+ if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height) ||
+ avctx->channels > SANE_NB_CHANNELS) {
av_freep(&avctx->priv_data);
ret = AVERROR(EINVAL);
goto end;