iraf-community / iraf-fitsutil

FITS utilities
https://iraf.readthedocs.io/en/latest/tasks/fitsutil
Other
2 stars 1 forks source link

fgwrite: memory allocation trouble #7

Closed olebole closed 6 years ago

olebole commented 6 years ago

The file fgwrite.c is obviously buggy in the memory allocation of slines. slines is globally defined: https://github.com/iraf-community/fitsutil/blob/a85313c562dd446c2e75f1f8835f971f5354f740/src/fgwrite.c#L112

This mess goes completely to hell when a reallocation is necessary. Not only is realloc() called with the wrong arguments; sptable was also incremented before (so that it does not point anymore to the allocated memory). And after a realloc, the free(ip) will free the wrong memory. Welcome to IRAF.