Commit 39e4c0bc authored by benoit's avatar benoit

Fix crash in PCM decoder when number of channels is not set.

Patch by "wg": video06 malloc de
See Issue298


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@11249 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 290def65
......@@ -384,10 +384,14 @@ static int pcm_decode_frame(AVCodecContext *avctx,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment