From b2a581dc71806df7aac7933b953a6ca410efd4bc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 9 Feb 2007 13:57:14 +0000 Subject: [PATCH] packets with half pcm samples are invalid Originally committed as revision 7900 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/pcm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 4011ed3b57..6cc4719a18 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -410,6 +410,12 @@ static int pcm_decode_frame(AVCodecContext *avctx, samples = data; src = buf; + n= av_get_bits_per_sample(avctx->codec_id)/8; + if(n && buf_size % n){ + av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n"); + return -1; + } + buf_size= FFMIN(buf_size, *data_size/2); *data_size=0;