Matteo Quintiliani
2011-09-16 23:23:54
Hi all,
I would like to report a bug: when you call the SAC command "CORRELATE" using the key "NORMALIZED", a segmentation fault occurs.
The problem is due to calling the function cross_correlation_normalized(), in xcorrelate.c:292, passing erroneously the variables "nlenmx" and "nfft". In fact, the function declaration in inc/dbh.h shows that it is necessary passing the pointers to those variable.
void cross_correlation_normalized(float *data1,
float *data2,
int *npts_data,
float *xcorr,
int *npts_xcorr);
I attach below my proposed bug fix.
Regards,
Matteo
============================================================
diff -p -r sac-101.4/src/sam/xcorrelate.c sac-101.4-changed/src/sam/xcorrelate.c
*** sac-101.4/src/sam/xcorrelate.c Thu Mar 26 21:30:19 2009
--- sac-101.4-changed/src/sam/xcorrelate.c Fri Sep 16 15:53:00 2011
*************** L_1200:
*** 252,260 ****
if(correlation_normalized) {
cross_correlation_normalized(cmmem.sacmem[ndxmas],
cmmem.sacmem[ndxsig],
! nlenmx,
cmmem.sacmem[ndxcor],
! nfft);
}
/* -- Perform a circular shift to align the correlation in the output block. */
/* overhauled to allow full range of correlation. maf 961204 */
--- 252,260 ----
if(correlation_normalized) {
cross_correlation_normalized(cmmem.sacmem[ndxmas],
cmmem.sacmem[ndxsig],
! &nlenmx,
cmmem.sacmem[ndxcor],
! &nfft);
}
/* -- Perform a circular shift to align the correlation in the output block. */
/* overhauled to allow full range of correlation. maf 961204 */
I would like to report a bug: when you call the SAC command "CORRELATE" using the key "NORMALIZED", a segmentation fault occurs.
The problem is due to calling the function cross_correlation_normalized(), in xcorrelate.c:292, passing erroneously the variables "nlenmx" and "nfft". In fact, the function declaration in inc/dbh.h shows that it is necessary passing the pointers to those variable.
void cross_correlation_normalized(float *data1,
float *data2,
int *npts_data,
float *xcorr,
int *npts_xcorr);
I attach below my proposed bug fix.
Regards,
Matteo
============================================================
diff -p -r sac-101.4/src/sam/xcorrelate.c sac-101.4-changed/src/sam/xcorrelate.c
*** sac-101.4/src/sam/xcorrelate.c Thu Mar 26 21:30:19 2009
--- sac-101.4-changed/src/sam/xcorrelate.c Fri Sep 16 15:53:00 2011
*************** L_1200:
*** 252,260 ****
if(correlation_normalized) {
cross_correlation_normalized(cmmem.sacmem[ndxmas],
cmmem.sacmem[ndxsig],
! nlenmx,
cmmem.sacmem[ndxcor],
! nfft);
}
/* -- Perform a circular shift to align the correlation in the output block. */
/* overhauled to allow full range of correlation. maf 961204 */
--- 252,260 ----
if(correlation_normalized) {
cross_correlation_normalized(cmmem.sacmem[ndxmas],
cmmem.sacmem[ndxsig],
! &nlenmx,
cmmem.sacmem[ndxcor],
! &nfft);
}
/* -- Perform a circular shift to align the correlation in the output block. */
/* overhauled to allow full range of correlation. maf 961204 */
-
Brian Savage2011-09-19 17:44:06Dear Matteo,
Thanks for the simple fix. This will be included in the upcoming version 101.5.
Brian Savage
savage<at>uri.edu
On Sep 16, 2011, at 10:23 AM, Matteo Quintiliani wrote:
Hi all,
I would like to report a bug: when you call the SAC command "CORRELATE" using the key "NORMALIZED", a segmentation fault occurs.
The problem is due to calling the function cross_correlation_normalized(), in xcorrelate.c:292, passing erroneously the variables "nlenmx" and "nfft". In fact, the function declaration in inc/dbh.h shows that it is necessary passing the pointers to those variable.
void cross_correlation_normalized(float *data1,
float *data2,
int *npts_data,
float *xcorr,
int *npts_xcorr);
I attach below my proposed bug fix.
Regards,
Matteo
============================================================
diff -p -r sac-101.4/src/sam/xcorrelate.c sac-101.4-changed/src/sam/xcorrelate.c
*** sac-101.4/src/sam/xcorrelate.c Thu Mar 26 21:30:19 2009
--- sac-101.4-changed/src/sam/xcorrelate.c Fri Sep 16 15:53:00 2011
*************** L_1200:
*** 252,260 ****
if(correlation_normalized) {
cross_correlation_normalized(cmmem.sacmem[ndxmas],
cmmem.sacmem[ndxsig],
! nlenmx,
cmmem.sacmem[ndxcor],
! nfft);
}
/* -- Perform a circular shift to align the correlation in the output block. */
/* overhauled to allow full range of correlation. maf 961204 */
--- 252,260 ----
if(correlation_normalized) {
cross_correlation_normalized(cmmem.sacmem[ndxmas],
cmmem.sacmem[ndxsig],
! &nlenmx,
cmmem.sacmem[ndxcor],
! &nfft);
}
/* -- Perform a circular shift to align the correlation in the output block. */
/* overhauled to allow full range of correlation. maf 961204 */
_______________________________________________
sac-dev mailing list
sac-dev<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/sac-dev