Closed EricTittley closed 4 months ago
fits/fitsbody.chas the line:
fits/fitsbody.c
npix = tab->naxisn[0] * tab->naxisn[1]; That's size_t = int * int
npix = tab->naxisn[0] * tab->naxisn[1];
size_t = int * int
If int * int is greater than INT_MAX (2147483647 = 2.1G) than the result is garbage.
int * int
INT_MAX
Easy fix, just force the promotion with casts: npix = (size_t)tab->naxisn[0] * (size_t)tab->naxisn[1];
npix = (size_t)tab->naxisn[0] * (size_t)tab->naxisn[1];
I've had to implement this for local users with large survey images. Best to make the change in the original source.
Thanks for the heads up! A classic one!
fits/fitsbody.c
has the line:npix = tab->naxisn[0] * tab->naxisn[1];
That'ssize_t = int * int
If
int * int
is greater thanINT_MAX
(2147483647 = 2.1G) than the result is garbage.Easy fix, just force the promotion with casts:
npix = (size_t)tab->naxisn[0] * (size_t)tab->naxisn[1];
I've had to implement this for local users with large survey images. Best to make the change in the original source.