From ab55b26e4b1521e5401f60a2f618f31579e9cc5c Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 5 Jul 2014 17:46:10 +0200 Subject: [PATCH] SWH/BodeShifterCV: fix out-of-bounds array access The xcoeffs array only has 100 elements and thus accessing xcoeffs[100] leads to undefined behaviour. --- plugins/LadspaEffect/swh/bode_shifter_cv_1432.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/LadspaEffect/swh/bode_shifter_cv_1432.c b/plugins/LadspaEffect/swh/bode_shifter_cv_1432.c index 41fb4f0..967edf6 100644 --- a/plugins/LadspaEffect/swh/bode_shifter_cv_1432.c +++ b/plugins/LadspaEffect/swh/bode_shifter_cv_1432.c @@ -247,7 +247,7 @@ static void runBodeShifterCV(LADSPA_Handle instance, unsigned long sample_count) /* Perform the Hilbert FIR convolution * (probably FFT would be faster) */ hilb = 0.0f; - for (i = 0; i <= NZEROS/2; i++) { + for (i = 0; i < NZEROS/2; i++) { hilb += (xcoeffs[i] * delay[(dptr - i*2) & (D_SIZE - 1)]); } -- 1.9.3 --- lmms-1.0.3/plugins/LadspaEffect/swh/surround_encoder_1401.c.orig 2014-09-18 22:46:21.446975318 +0200 +++ lmms-1.0.3/plugins/LadspaEffect/swh/surround_encoder_1401.c 2014-09-18 22:50:07.186985543 +0200 @@ -228,7 +228,7 @@ for (pos = 0; pos < sample_count; pos++) { delay[dptr] = s[pos]; hilb = 0.0f; - for (i = 0; i <= NZEROS/2; i++) { + for (i = 0; i < NZEROS/2; i++) { hilb += (xcoeffs[i] * delay[(dptr - i*2) & (D_SIZE - 1)]); } dptr = (dptr + 1) & (D_SIZE - 1); @@ -296,7 +296,7 @@ for (pos = 0; pos < sample_count; pos++) { delay[dptr] = s[pos]; hilb = 0.0f; - for (i = 0; i <= NZEROS/2; i++) { + for (i = 0; i < NZEROS/2; i++) { hilb += (xcoeffs[i] * delay[(dptr - i*2) & (D_SIZE - 1)]); } dptr = (dptr + 1) & (D_SIZE - 1);