#216 Malloc > 2 GB in tfc.c cause allocation to fail


In tfc.c, one finds thrice this call to malloc:


j*ATL_sizeof seems to be a signed 32-bit quantity, but malloc expects a size_t type which is 64-bit long on 64-bit systems. So it is extended to 64 bits and when it exceeds 2 GB this extension becomes a big negative number that causes malloc to fail. Casting both operands to (unsigned long) seems to solve the issue.


  • Anthony Castaldo

    Ticket moved from /p/math-atlas/support-requests/914/

  • Anthony Castaldo

    I confirm this as a bug, moving to the buglist. I think we can fix in the header files.

  • R. Clint Whaley

    R. Clint Whaley - 2013-07-23

    Thank you very much for this bug report. I have fixed in the developer basefiles, by changing ATLAS/tune/sysinfo/emit_typ.c to cast all ATL_?size macros to size_t, which should propogate to tfc as well as anywhere else where this is a problem.

    Need to make fix to the stable basefiles as well, and post errata.

    Once this is done, and 3.10.13 is released, can close this bug report.

  • R. Clint Whaley

    R. Clint Whaley - 2013-10-03

    errataed, and fixed in both basefiles -- closing.

  • R. Clint Whaley

    R. Clint Whaley - 2013-10-03
    • status: open --> closed-fixed
    • Group: Developer_(v3.11.x) --> Both

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks