summaryrefslogtreecommitdiff
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-04-19 20:40:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-04-19 20:40:56 +0000
commit012e4f5a18b11813e9b5a51181ef783b78959d21 (patch)
tree55a0276c949acb0012449e661795781e51bf7161 /libavcodec/pcm.c
parentb40831715a8c2a607094bf3d66bc384bd3fada61 (diff)
downloadffmpeg-012e4f5a18b11813e9b5a51181ef783b78959d21.tar.gz
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
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c3
1 files changed, 3 insertions, 0 deletions
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);