changeset 7628:2f5ed95d1039 libavcodec

Fix PCM DVD divide by zero bug introduced in r14659. Patch supplied by lars dot taeuber at gmx dot net.
author pross
date Wed, 20 Aug 2008 11:05:15 +0000
parents 93c5703328d6
children 1d04f38681bd
files pcm.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pcm.c	Wed Aug 20 01:02:32 2008 +0000
+++ b/pcm.c	Wed Aug 20 11:05:15 2008 +0000
@@ -350,11 +350,12 @@
 
     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");