changeset 9077:ad7fd7a40717 libavcodec

Do not read uninitialized buffer, no matter if it will be multiplied by zero later. This should fix some valgrind warnings and hopefully FATE ra144 test on ARM.
author vitor
date Sun, 01 Mar 2009 11:14:21 +0000
parents 4557a8635262
children 2692e0a168cf
files ra144.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ra144.c	Sun Mar 01 09:14:20 2009 +0000
+++ b/ra144.c	Sun Mar 01 11:14:21 2009 +0000
@@ -138,8 +138,13 @@
     for (i=!skip_first; i<3; i++)
         v[i] = (gain_val_tab[n][i] * m[i]) >> gain_exp_tab[n];
 
+    if (v[0]) {
     for (i=0; i < BLOCKSIZE; i++)
         dest[i] = (s1[i]*v[0] + s2[i]*v[1] + s3[i]*v[2]) >> 12;
+    } else {
+        for (i=0; i < BLOCKSIZE; i++)
+            dest[i] = (s2[i]*v[1] + s3[i]*v[2]) >> 12;
+    }
 }
 
 static unsigned int rescale_rms(unsigned int rms, unsigned int energy)