comparison 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
comparison
equal deleted inserted replaced
10178:140aa1e7328b 10179:0ac7e80ecc76
469 if(avctx->coded_width && avctx->coded_height) 469 if(avctx->coded_width && avctx->coded_height)
470 avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); 470 avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
471 else if(avctx->width && avctx->height) 471 else if(avctx->width && avctx->height)
472 avcodec_set_dimensions(avctx, avctx->width, avctx->height); 472 avcodec_set_dimensions(avctx, avctx->width, avctx->height);
473 473
474 if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height)){ 474 #define SANE_NB_CHANNELS 128U
475 if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height) ||
476 avctx->channels > SANE_NB_CHANNELS) {
475 av_freep(&avctx->priv_data); 477 av_freep(&avctx->priv_data);
476 ret = AVERROR(EINVAL); 478 ret = AVERROR(EINVAL);
477 goto end; 479 goto end;
478 } 480 }
479 481