msvcrt: Treat large exponent as overflow in strtod.

Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2020-07-16 13:10:37 +02:00 committed by Alexandre Julliard
parent 0945ba00fb
commit ee65859b7f
2 changed files with 6 additions and 1 deletions

View File

@ -423,7 +423,7 @@ static double make_double(int sign, int exp, ULONGLONG m, enum round round, int
}
}
if (exp >= 1<<EXP_BITS)
if (exp >= (1<<EXP_BITS)-1)
{
if (err) *err = MSVCRT_ERANGE;
return sign * INFINITY;

View File

@ -1956,7 +1956,12 @@ static void test__strtod(void)
{ "0.1d238", 7, 0.1e238 },
{ "0.1D-4736", 9, 0, ERANGE },
{ "3.4028234663852887e38", 21, FLT_MAX },
{ "1.1754943508222875e-38", 22, FLT_MIN },
{ "1.7976931348623158e+308", 23, DBL_MAX },
{ "1.7976931348623159e+308", 23, INFINITY, ERANGE },
{ "2.2250738585072014e-308", 23, DBL_MIN },
{ "-1.7976931348623158e+308", 24, -DBL_MAX },
{ "-1.7976931348623159e+308", 24, -INFINITY, ERANGE },
{ "00", 2, 0 },
{ "00.", 3, 0 },
{ ".00", 3, 0 },