From 31d393cd459af3d8f7cc723eb0d4cad4d83d8abc Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Sun, 5 Jun 2016 16:40:45 +0000 Subject: [PATCH] Found and fixed a nasty array overrun problem. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6730 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/msk144_decode.f90 | 3 +-- lib/syncmsk144.f90 | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/msk144_decode.f90 b/lib/msk144_decode.f90 index cf911974e..ea5eafbe3 100644 --- a/lib/msk144_decode.f90 +++ b/lib/msk144_decode.f90 @@ -58,8 +58,7 @@ subroutine msk144_decode(id2,npts,nutc,nprint,line) iz=ib-ia+1 cdat2(1:iz)=c(ia:ib) !Select nlen complex samples t0=ia/12000.0 - call syncmsk144(cdat2,iz,metric,msg,freq) - if(metric.eq.-9999) cycle !No output if no significant sync + call syncmsk144(cdat2,iz,msg,freq) if(msg(1:1).ne.' ') then ! if(msg.ne.msg0) then nline=nline+1 diff --git a/lib/syncmsk144.f90 b/lib/syncmsk144.f90 index f70ad9099..9a8ddf58d 100644 --- a/lib/syncmsk144.f90 +++ b/lib/syncmsk144.f90 @@ -1,4 +1,4 @@ -subroutine syncmsk144(cdat,npts,metric,msgreceived,fest) +subroutine syncmsk144(cdat,npts,msgreceived,fest) use iso_c_binding, only: c_loc,c_size_t use packjt use hashing @@ -25,7 +25,6 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest) integer*1, allocatable :: message(:) integer*1 i1hashdec integer ipeaks(10) - integer metric logical ismask(6000) real cbi(42),cbq(42) real tonespec(6000) @@ -42,7 +41,6 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest) data s8/0,1,1,1,0,0,1,0/ save first,cb,pi,twopi,dt,f0,f1 ! save - if(first) then ! These files can be found in /lib/ldpc/jtmode_codes directory pchk_file="peg-128-80-reg3.pchk" @@ -136,7 +134,6 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest) dd(max(1,ic2-7):min(npts-56*6-41,ic2+7))=0.0 enddo - ! See if we can find "closed brackets" - a pair of peaks that differ by 864, plus or minus ! This information is not yet used for anything do ii=1,5 @@ -206,7 +203,7 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest) fest=1500+ferr+ferr2 ! Remove fine frequency error - call tweak1(c,npts,-ferr2,c) + call tweak1(c,NSPM,-ferr2,c) ! Estimate final frequency error and carrier phase. cca=sum(c(1:1+41)*conjg(cb)) @@ -268,6 +265,7 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest) if( niterations .ge. 0.0 ) then goto 778 endif + enddo enddo enddo