aboutsummaryrefslogtreecommitdiff
path: root/src/vector.c
diff options
context:
space:
mode:
authorJamie Bullock <jamie@jamiebullock.com>2013-06-19 16:04:42 -0700
committerJamie Bullock <jamie@jamiebullock.com>2013-06-19 16:23:50 -0700
commit9438ea161e94491fc4f73df3a68ce9229193deda (patch)
treec758f945af928adc537d7f6c33119ab1a0e8f85d /src/vector.c
parent5f76abb520203a69a328cebe851f03e41c0ac3ea (diff)
downloadLibXtract-9438ea161e94491fc4f73df3a68ce9229193deda.tar.gz
LibXtract-9438ea161e94491fc4f73df3a68ce9229193deda.tar.bz2
LibXtract-9438ea161e94491fc4f73df3a68ce9229193deda.zip
Don't read past end of spectral data array
Diffstat (limited to 'src/vector.c')
-rw-r--r--src/vector.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vector.c b/src/vector.c
index 5d88882..14bee9d 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -116,6 +116,11 @@ int xtract_spectrum(const double *data, const int N, const void *argv, double *r
{
++n;
}
+ if(n == M)
+ {
+ XTRACT_SET_FREQUENCY;
+ break;
+ }
real = fft[n*2];
imag = fft[n*2+1];
@@ -161,6 +166,11 @@ int xtract_spectrum(const double *data, const int N, const void *argv, double *r
{
++n;
}
+ if(n == M)
+ {
+ XTRACT_SET_FREQUENCY;
+ break;
+ }
real = fft[n*2];
imag = fft[n*2+1];
@@ -192,6 +202,11 @@ int xtract_spectrum(const double *data, const int N, const void *argv, double *r
{
++n;
}
+ if(n == M)
+ {
+ XTRACT_SET_FREQUENCY;
+ break;
+ }
real = fft[n*2];
imag = fft[n*2+1];
@@ -231,6 +246,12 @@ int xtract_spectrum(const double *data, const int N, const void *argv, double *r
{
++n;
}
+ if(n == M)
+ {
+ XTRACT_SET_FREQUENCY;
+ break;
+ }
+
real = fft[n*2];
imag = fft[n*2+1];
#else