diff utils.c @ 10179:0ac7e80ecc76 libavcodec

perform sanity check on number of audio channels in avcodec_open()
author pross
date Wed, 16 Sep 2009 11:29:47 +0000
parents 7ad7d4094d1f
children 1b2ef85867a9
line wrap: on
line diff
--- a/utils.c	Wed Sep 16 07:50:09 2009 +0000
+++ b/utils.c	Wed Sep 16 11:29:47 2009 +0000
@@ -471,7 +471,9 @@
     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;