changeset 4506:709ddd620e04 libavcodec

packets with half pcm samples are invalid
author michael
date Fri, 09 Feb 2007 13:57:14 +0000
parents cb5628800a62
children b80c704183e9
files pcm.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pcm.c	Fri Feb 09 12:37:38 2007 +0000
+++ b/pcm.c	Fri Feb 09 13:57:14 2007 +0000
@@ -410,6 +410,12 @@
     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;