Menu

#599 Demangling float values on 32 bit systems

RELEASE_1_0
new
nobody
None
2020-11-21
2020-11-21
No

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.

Discussion


Log in to post a comment.