summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2022-06-28 02:07:08 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2022-06-28 02:07:08 -0400
commitccb42e05cc6eb98a15874b9695361025b3ee17ab (patch)
tree25ff980204b2422a50ccef1b5391ecbc871fe03e
parentd7d4b3487f9b352942d868d056cba520fc4346c7 (diff)
downloadopus-ccb42e05cc6eb98a15874b9695361025b3ee17ab.tar.gz
Fixes valgrind failure caused by silk_find_pred_coefs_*()
The function copies NLSFs from the stack to the state which for order 10 means we were copying uninitialized values. That in turn breaks check-asm when comparing the state under valgrind. Reviewed by Timothy B. Terriberry.
-rw-r--r--silk/fixed/find_pred_coefs_FIX.c3
-rw-r--r--silk/float/find_pred_coefs_FLP.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/silk/fixed/find_pred_coefs_FIX.c b/silk/fixed/find_pred_coefs_FIX.c
index 606d8633..ad363fb7 100644
--- a/silk/fixed/find_pred_coefs_FIX.c
+++ b/silk/fixed/find_pred_coefs_FIX.c
@@ -42,7 +42,8 @@ void silk_find_pred_coefs_FIX(
{
opus_int i;
opus_int32 invGains_Q16[ MAX_NB_SUBFR ], local_gains[ MAX_NB_SUBFR ];
- opus_int16 NLSF_Q15[ MAX_LPC_ORDER ];
+ /* Set to NLSF_Q15 to zero so we don't copy junk to the state. */
+ opus_int16 NLSF_Q15[ MAX_LPC_ORDER ]={0};
const opus_int16 *x_ptr;
opus_int16 *x_pre_ptr;
VARDECL( opus_int16, LPC_in_pre );
diff --git a/silk/float/find_pred_coefs_FLP.c b/silk/float/find_pred_coefs_FLP.c
index dcf7c520..6f790788 100644
--- a/silk/float/find_pred_coefs_FLP.c
+++ b/silk/float/find_pred_coefs_FLP.c
@@ -44,7 +44,8 @@ void silk_find_pred_coefs_FLP(
silk_float XXLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ];
silk_float xXLTP[ MAX_NB_SUBFR * LTP_ORDER ];
silk_float invGains[ MAX_NB_SUBFR ];
- opus_int16 NLSF_Q15[ MAX_LPC_ORDER ];
+ /* Set to NLSF_Q15 to zero so we don't copy junk to the state. */
+ opus_int16 NLSF_Q15[ MAX_LPC_ORDER ]={0};
const silk_float *x_ptr;
silk_float *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ];
silk_float minInvGain;