From 3c1fe294565f7574c2e1d934a49f5ef2456b8eb8 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 12 Apr 2016 13:13:27 +0000 Subject: [PATCH] Protect against bounds errors with large NTol. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6611 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/decode9w.f90 | 4 ++-- lib/lorentzian.f90 | 2 -- lib/softsym9w.f90 | 10 ++++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/decode9w.f90 b/lib/decode9w.f90 index b4f02c628..b601d8ce7 100644 --- a/lib/decode9w.f90 +++ b/lib/decode9w.f90 @@ -17,8 +17,8 @@ subroutine decode9w(nutc,nfqso,ntol,nsubmode,ss,id2,sync,nsnr,xdt1,f0,decoded) npts=52*12000 limit=10000 !Fano timeout parameter - ia=nint((nfqso-ntol)/df) !Start frequency bin - ib=nint((nfqso+ntol)/df) !End frequency bin + ia=max(1,nint((nfqso-ntol)/df)) !Start frequency bin + ib=min(NSMAX,nint((nfqso+ntol)/df)) !End frequency bin lag1=-int(2.5/tstep + 0.9999) !Start lag lag2=int(5.0/tstep + 0.9999) !End lag nhsym=184 !Number of half-symbols diff --git a/lib/lorentzian.f90 b/lib/lorentzian.f90 index 33d6ff661..cd2257a75 100644 --- a/lib/lorentzian.f90 +++ b/lib/lorentzian.f90 @@ -12,8 +12,6 @@ subroutine lorentzian(y,npts,a) real a(5) real deltaa(4) - if(npts.gt.2000) stop 'Error in lorentzian' - a=0. df=12000.0/8192.0 !df = 1.465 Hz width=0. diff --git a/lib/softsym9w.f90 b/lib/softsym9w.f90 index d84b46f7b..266b9314c 100644 --- a/lib/softsym9w.f90 +++ b/lib/softsym9w.f90 @@ -13,12 +13,10 @@ subroutine softsym9w(id2,npts,xdt0,f0,width,nsubmode,xdt1,i1softsymbols) equivalence (x,cx) df=12000.0/NFFT -! i0a=1 -! i0b=5*12000 i0a=max(1.0,(xdt0-1.0)*12000.0) i0b=(xdt0+1.0)*12000.0 - k1=nint((f0-0.5*width)/df) - k2=nint((f0+0.5*width)/df) + k1=max(1,nint((f0-0.5*width)/df)) + k2=min(NQ,nint((f0+0.5*width)/df)) smax=0. i0pk=1 i1softsymbols=0 @@ -60,8 +58,8 @@ subroutine softsym9w(id2,npts,xdt0,f0,width,nsubmode,xdt1,i1softsymbols) dtone=df*(2**nsubmode) do i=0,8 f=f0 + i*dtone - k1=nint((f-0.5*width)/df) - k2=nint((f+0.5*width)/df) + k1=max(1,nint((f-0.5*width)/df)) + k2=min(NQ,nint((f+0.5*width)/df)) s2(i,j)=sum(s(k1:k2)) !Symbol spectra, including sync enddo