From 012e4f5a18b11813e9b5a51181ef783b78959d21 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 19 Apr 2009 20:40:56 +0000 Subject: Do not discard truncated packets. Based on a patch by Maksym Veremeyenko verem DOT m1stereo AT tv Originally committed as revision 18626 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/pcm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index ca42b53f8d..beb831b121 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -361,8 +361,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, n = avctx->channels * sample_size; if(n && buf_size % n){ + if (buf_size < n) { av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n"); return -1; + }else + buf_size -= buf_size % n; } buf_size= FFMIN(buf_size, *data_size/2); -- cgit v1.2.3