Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subroutine R63W72() intentionally overwrites array memory #216

Open
edwardhartnett opened this issue Oct 3, 2023 · 2 comments
Open

subroutine R63W72() intentionally overwrites array memory #216

edwardhartnett opened this issue Oct 3, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@edwardhartnett
Copy link
Contributor

In R63W72() we have this chilling comment:

C> @note kgds and igds extend beyond their dimensions here
C> if pl parameters are present.

When this function is called from some NCEPLIBS-g2 function during testing, this condition can be found. See NOAA-EMC/NCEPLIBS-g2#385.

In the subroutine we have:

      SUBROUTINE R63W72(KPDS,KGDS,IPDS,IGDS)
      DIMENSION KPDS(200),KGDS(200),IPDS(200),IGDS(200)

and later:

C  EXTENSION FOR PL PARAMETERS
      IF(KGDS(1).EQ.0.AND.KGDS(19).EQ.0.AND.KGDS(20).NE.255) THEN
        DO J=1,KGDS(3)
          IGDS(18+J)=KGDS(21+J)
        ENDDO
      ENDIF

If KGDS(3) > 179, this will overwrite the boundary of the KGDS array.

I'm not sure what to do about this. @GeorgeGayno-NOAA or @GeorgeVandenberghe-NOAA do you know why this would be done?

@edwardhartnett edwardhartnett added the bug Something isn't working label Oct 3, 2023
@edwardhartnett edwardhartnett self-assigned this Oct 3, 2023
@GeorgeVandenberghe-NOAA
Copy link

GeorgeVandenberghe-NOAA commented Oct 3, 2023 via email

@GeorgeVandenberghe-NOAA
Copy link

GeorgeVandenberghe-NOAA commented Oct 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants