On some systems (e.g. 32 bit armv7l systems running GNU/Linux), the long double
and double
floating point types have the same size.
File libelftc/libelftc_dem_gnu3.c
however assumes that a long double
is one of 10 or 16 bytes in size.
#define FLOAT_QUADRUPLE_BYTES 16 #define FLOAT_EXTENDED_BYTES 10 switch(sizeof(long double)) { case FLOAT_QUADRUPLE_BYTES: /* ... etc ... */
As written, the code also risks causing memory corruption on these systems:
long double f; memset(&f, 0, FLOAT_QUADRUPLE_BYTES); memcpy(&f, buf, FLOAT_EXTENDED_BYTES);
We need an architecture-independent way of decoding mangled floating-point values.