aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-02-09 13:57:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-02-09 13:57:14 +0000
commitb2a581dc71806df7aac7933b953a6ca410efd4bc (patch)
tree7de5e356498721696a14ed9900e7643480ada6c8 /libavcodec/pcm.c
parent7e0429129c897f92b6fbed2d3952e3362c90a3b0 (diff)
downloadffmpeg-b2a581dc71806df7aac7933b953a6ca410efd4bc.tar.gz
packets with half pcm samples are invalid
Originally committed as revision 7900 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c6
1 files changed, 6 insertions, 0 deletions
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;