diff options
Diffstat (limited to 'main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch')
-rw-r--r-- | main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch b/main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch new file mode 100644 index 0000000000..623729e37a --- /dev/null +++ b/main/musl/0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch @@ -0,0 +1,35 @@ +From e314258e2fe75b7443db84d2927315dea0f337c8 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Thu, 20 Oct 2016 14:40:59 -0400 +Subject: [PATCH 25/25] fix minor problem in previous strtod non-nearest + rounding bug fix + +commit 6ffdc4579ffb34f4aab69ab4c081badabc7c0a9a set lnz in the code +path for non-zero digits after a huge string of zeros, but the +assignment of dc to lnz truncates if the value of dc does not fit in +int; this is possible for some pathologically long inputs, either via +strings on 64-bit systems or via scanf-family functions. + +instead, simply set lnz to match the point at which we add the +artificial trailing 1 bit to simulate nonzero digits after a huge +run of zeros. +--- + src/internal/floatscan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c +index ae09852..278bf25 100644 +--- a/src/internal/floatscan.c ++++ b/src/internal/floatscan.c +@@ -111,7 +111,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po + } else { + dc++; + if (c!='0') { +- lnz = dc; ++ lnz = (KMAX-4)*9; + x[KMAX-4] |= 1; + } + } +-- +2.10.1 + |