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

gdt2gds.f causes segfault for some values of arguments #385

Open
edwardhartnett opened this issue May 12, 2023 · 1 comment
Open

gdt2gds.f causes segfault for some values of arguments #385

edwardhartnett opened this issue May 12, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@edwardhartnett
Copy link
Contributor

There are some untested conditions.

@edwardhartnett edwardhartnett added the test Testing is important! label May 12, 2023
@edwardhartnett
Copy link
Contributor Author

This code is 97.9% tested. There are three untested sections of code, all activate the same code in the w3emc library, function r63w72().

In this function we see the cryptic comment:

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

These arrays are declared to be of size 200 in the code:

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

But later in the code:

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

The problem here is that the gdt2gds() function seems to call r63w72() in such a way as to overwrite the ends of the IGDS array, and read beyond the end of the KGDS arrray.

Is this a bug? It's not clear how this can ever work...

@edwardhartnett edwardhartnett changed the title Complete testing for gdt2gds.f gdt2gds.f causes segfault for some values of arguments Oct 3, 2023
@edwardhartnett edwardhartnett added bug Something isn't working and removed test Testing is important! labels Oct 3, 2023
@edwardhartnett edwardhartnett self-assigned this Oct 3, 2023
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

1 participant