diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-08-02 19:34:22 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-08-02 19:34:22 -0400 |
commit | 86cc54b577f445da1582d2cf1ac3eff064ca27ef (patch) | |
tree | 6e97212567048708456eb035e920fb92fd42f7c8 /src/stdio/vfprintf.c | |
parent | 2f820f3b1f639fee30f5bfa31aa3191758573f25 (diff) | |
download | musl-86cc54b577f445da1582d2cf1ac3eff064ca27ef.zip musl-86cc54b577f445da1582d2cf1ac3eff064ca27ef.tar.gz musl-86cc54b577f445da1582d2cf1ac3eff064ca27ef.tar.bz2 |
protect against long double type mismatches (mainly powerpc for now)
check in configure to be polite (failing early if we're going to fail)
and in vfprintf.c since that is the point at which a mismatching type
would be extremely dangerous.
Diffstat (limited to 'src/stdio/vfprintf.c')
-rw-r--r-- | src/stdio/vfprintf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 1e7e6a4..a2b287b 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -198,6 +198,13 @@ static char *fmt_u(uintmax_t x, char *s) return s; } +/* Do not override this check. The floating point printing code below + * depends on the float.h constants being right. If they are wrong, it + * may overflow the stack. */ +#if LDBL_MANT_DIG == 53 +typedef char compiler_defines_long_double_incorrectly[9-(int)sizeof(long double)]; +#endif + static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) { uint32_t big[(LDBL_MAX_EXP+LDBL_MANT_DIG)/9+1]; |