From b84a07349c1fc59e87747237c26f35831fd14d37 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 6 Jun 2016 02:48:06 +0000 Subject: [PATCH] fixed an array overrun git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6737 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/syncmsk144.f90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/syncmsk144.f90 b/lib/syncmsk144.f90 index f63a18a5c..7f3402475 100644 --- a/lib/syncmsk144.f90 +++ b/lib/syncmsk144.f90 @@ -163,12 +163,15 @@ subroutine syncmsk144(cdat,npts,msgreceived,fest) ! we want ic to be the index of the first sample of the message ic=ipeaks(ipk) + if( ic .le. 864 ) ic=ic+864 + if( ic .gt. 2*864 ) ic=ic-864 ! now do fine adjustment of sync index ! bb is used to place the sampling index at the center of the eye do i=1,6 io=i-3 - ul=min(ic+io+6+864,npts) - bb(i) = sum( ( cdat(ic+io:ul-6:6) * conjg( cdat(ic+io+6:ul:6) ) )*2 ) + ill=max(1,ic+io) + iul=min(ic+io+6+864,npts) + bb(i) = sum( ( cdat(ic+io:iul-6:6) * conjg( cdat(ic+io+6:iul:6) ) )*2 ) enddo iloc=maxloc(abs(bb)) ibb=iloc(1)