clapack: fix stack buffer overflow in ilaenv_ and prevent Intel runtime symbol interposition
Summary
Two bugs in the bundled CLAPACK were fixed:
- Buffer overflow in
ilaenv_(ilaenv.c): the f2c-translated local variablesubnamwas declared aschar subnam[1]instead of the correctchar subnam[6](mistranslation of FortranCHARACTER*6 SUBNAM). The subsequent uppercase-conversion loop ands_copycall wrote out of bounds. - Symbol interposition by Intel's Fortran runtime (libifcore/MKL):
s_cmp,s_copy, and related f2c helpers share names with Intel's runtime, which exports them with 32-bit int length arguments (vs. f2c's 64-bit ftnlen). When Intel libraries appear in the same link the dynamic linker resolves these to Intel's ABI-incompatible versions, causing stack corruption. The existing blaswrap.h rename mechanism (already used for all BLAS symbols) is extended with 12 new#definerenames covering the affected f2c helpers and LAPACK utility routines. The#include "blaswrap.h"is added to f2c.h so that the renames apply uniformly to all CLAPACK translation units, including F2CLIBS.
Documentation
Checklist
- All code changes are covered by unit tests
- Code coverage did not deteriorate
- Code follows Style Guide
- Documentation updated, if necessary
- WIP: Manual running of configure/build jobs was successful
- Update changelog, if changes are worth mentioning
(
Developsection indoc/src/changelog.dox, add section if not yet included)