# HG changeset patch # User pross # Date 1253100587 0 # Node ID 0ac7e80ecc7663a599be05d9c475af6914139bbd # Parent 140aa1e7328b2281e76849f7c6fc4f240ee9864b perform sanity check on number of audio channels in avcodec_open() diff -r 140aa1e7328b -r 0ac7e80ecc76 utils.c --- 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;