# HG changeset patch # User Jamie Bullock # Date 1226404555 0 # Node ID 75e14c9881ee0fe6f4cfdf85f83a8b45b59e1158 # Parent 8c8b508dcc954a46ffa0e75150a763d9d884eb44 - Committed patch by Chris Cannam to avoid reading past the end of an array in peak detection routine in xtract_peak_spectrum() diff -r 8c8b508dcc95 -r 75e14c9881ee src/vector.c --- 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])));