ref: 98a6042bb67bbe0ddd9d4291de4292c6882bb095
parent: 8489ff3ffa6930ee32a9616ca10c7dceceb05f8d
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Mon Jul 4 20:16:44 EDT 2022
Avoids incrementing uninitialized values The values were never used, but ubsan + valgrind would complain. Reviewed by Mark Harris
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1719,8 +1719,11 @@
compute_mdcts(mode, 0, in, freq, C, CC, LM, st->upsample, st->arch);
compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch);
amp2Log2(mode, effEnd, end, bandE, bandLogE2, C);
- for (i=0;i<C*nbEBands;i++)
- bandLogE2[i] += HALF16(SHL16(LM, DB_SHIFT));
+ for (c=0;c<C;c++)
+ {
+ for (i=0;i<end;i++)
+ bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT));
+ }
}
compute_mdcts(mode, shortBlocks, in, freq, C, CC, LM, st->upsample, st->arch);
@@ -1856,8 +1859,11 @@
compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch);
amp2Log2(mode, effEnd, end, bandE, bandLogE, C);
/* Compensate for the scaling of short vs long mdcts */
- for (i=0;i<C*nbEBands;i++)
- bandLogE2[i] += HALF16(SHL16(LM, DB_SHIFT));
+ for (c=0;c<C;c++)
+ {
+ for (i=0;i<end;i++)
+ bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT));
+ }
tf_estimate = QCONST16(.2f,14);
}
}