summaryrefslogtreecommitdiff
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2008-08-20 11:05:15 +0000
committerPeter Ross <pross@xvid.org>2008-08-20 11:05:15 +0000
commit2cd04cf919ce2f22da391bd80b7664a25348b943 (patch)
tree89e75951a9d3db58ff1b3d459e59af78fd16a360 /libavcodec/pcm.c
parentab2a942ad8d98d64c626edb5ba84631d855aaea9 (diff)
Fix PCM DVD divide by zero bug introduced in r14659. Patch supplied by lars dot taeuber at gmx dot net.
Originally committed as revision 14864 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 6317e37b9b..c0ac736512 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -350,11 +350,12 @@ static int pcm_decode_frame(AVCodecContext *avctx,
sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
- n = avctx->channels * sample_size;
/* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
if (CODEC_ID_PCM_DVD == avctx->codec_id)
/* 2 samples are interleaved per block in PCM_DVD */
- n = 2 * avctx->channels * avctx->bits_per_sample/8;
+ sample_size = avctx->bits_per_sample * 2 / 8;
+
+ n = avctx->channels * sample_size;
if(n && buf_size % n){
av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");