View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum ↗

iraf-v216 · Code · Issues (50) · Pull requests (81)

iraf.net pull request #127

f2c: Fix allocated size of Dimblock

merge olebole merged 1 commit to iraf-community/iraf


olebole commented on 2018-01-23

Generally, the size of a structure is not just the sum of the sizes of its members, since padding may require additional space. For Dimblock, this is the case, since the first member is an int, and the next one is a pointer: on 64-bit platforms, int is 4 bytes, while pointers are 8 bytes and therefore 4 bytes padding are inserted.

This patch fixes the allocated size by using the real size of the structure.

The patch also sets the length of the dims member to unspecified, to avoid compilers to optimize out the access to the member. See #60 for fixes of other similar issues.

With this patch, f2c.e does not complain anymore when sanitized for memory error (tested on 64 bit x86). The created code works perfectly on all platforms, as tested here.


Commits


Last updated on 2018-01-23