Mercurial > libavcodec.hg
changeset 6033:bd7600c7a061 libavcodec
Fix crash in PCM decoder when number of channels is not set.
Patch by "wg": video06 malloc de
See Issue298
author | benoit |
---|---|
date | Mon, 17 Dec 2007 10:41:47 +0000 |
parents | f74202e7e896 |
children | 72bb141d9c05 |
files | pcm.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pcm.c Mon Dec 17 01:09:00 2007 +0000 +++ b/pcm.c Mon Dec 17 10:41:47 2007 +0000 @@ -384,10 +384,14 @@ src = buf; n= av_get_bits_per_sample(avctx->codec_id)/8; - if((n && buf_size % n) || avctx->channels > MAX_CHANNELS){ + if(n && buf_size % n){ av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n"); return -1; } + if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){ + av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n"); + return -1; + } buf_size= FFMIN(buf_size, *data_size/2); *data_size=0;