Should avoid running log2Amp on uninitialized data
authorJean-Marc Valin <jean-marc.valin@octasic.com>
Wed, 26 Jan 2011 15:00:28 +0000 (10:00 -0500)
committerJean-Marc Valin <jean-marc.valin@octasic.com>
Wed, 26 Jan 2011 15:00:28 +0000 (10:00 -0500)
libcelt/quant_bands.c

index 09785eb..8a9fe8e 100644 (file)
@@ -545,12 +545,16 @@ void log2Amp(const CELTMode *m, int start, int end,
    const int C = CHANNELS(_C);
    c=0;
    do {
-      for (i=start;i<m->nbEBands;i++)
+      for (i=0;i<start;i++)
+         eBands[i+c*m->nbEBands] = 0;
+      for (;i<end;i++)
       {
          celt_word16 lg = oldEBands[i+c*m->nbEBands]
                         + SHL16((celt_word16)eMeans[i],6);
          eBands[i+c*m->nbEBands] = PSHR32(celt_exp2(SHL16(lg,11-DB_SHIFT)),4);
       }
+      for (;i<m->nbEBands;i++)
+         eBands[i+c*m->nbEBands] = 0;
    } while (++c < C);
 }