Skip to content

Commit

Permalink
Fix some out-of-bounds reads that caused the RRFS UPP to crash. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTrahanNOAA authored Apr 1, 2021
1 parent b6e5b25 commit 6ec6c91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sorc/ncep_post.fd/CLDRAD.f
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ SUBROUTINE CLDRAD
CLDZ(I,J) = ceil_min + FIS(I,J)*GI ! convert back to ASL and store
CLDZ(I,J) = max(min(CLDZ(I,J), 20000.0),0.0) !set bounds
! find pressure at CLDZ
do k=1,lm-2
do k=2,lm-2
if ( zmid(i,j,lm-k+1) >= CLDZ(i,j) ) then
CLDP(I,J) = pmid(i,j,lm-k+2) + (CLDZ(i,j)-zmid(i,j,lm-k+2)) &
*(pmid(i,j,lm-k+1)-pmid(i,j,lm-k+2) ) &
Expand Down
7 changes: 4 additions & 3 deletions sorc/ncep_post.fd/INITPOST_NETCDF.f
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ SUBROUTINE INITPOST_NETCDF(ncid3d)

! sample print point
ii = im/2
jj = jm/2
jj = (jsta+jend)/2

print *,me,'max(gdlat)=', maxval(gdlat), &
'max(gdlon)=', maxval(gdlon)
Expand Down Expand Up @@ -944,8 +944,9 @@ SUBROUTINE INITPOST_NETCDF(ncid3d)
pint(i,j,l) = pint(i,j,l-1) + dpres(i,j,l-1)
enddo
enddo
if (me == 0) print*,'sample model pint,pmid' ,ii,jj,l &
,pint(ii,jj,l),pmid(ii,jj,l)
! The next two lines crash.
! if (me == 0) print*,'sample model pint,pmid' ,ii,jj,l &
! ,pint(ii,jj,l),pmid(ii,jj,l)
end do

! do l=lm,1,-1
Expand Down

0 comments on commit 6ec6c91

Please sign in to comment.