changeset 119:75e14c9881ee

- Committed patch by Chris Cannam to avoid reading past the end of an array in peak detection routine in xtract_peak_spectrum()
author Jamie Bullock <jamie@postlude.co.uk>
date Tue, 11 Nov 2008 11:55:55 +0000
parents 8c8b508dcc95
children d9c5cd78abaa
files src/vector.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/vector.c	Fri Sep 12 13:52:20 2008 +0000
+++ b/src/vector.c	Tue Nov 11 11:55:55 2008 +0000
@@ -435,7 +435,7 @@
 
     for(n = 1; n < N; n++){
         if(input[n] >= threshold){
-            if(input[n] > input[n - 1] && input[n] > input[n + 1]){
+            if(input[n] > input[n - 1] && n + 1 < N && input[n] > input[n + 1]){
                 result[N + n] = q * (n + (p = .5 * ((y = input[n-1]) - 
 				(y3 = input[n+1])) / (input[n - 1] - 2 * 
 				    (y2 = input[n]) + input[n + 1])));