msvcrt: Fix 0 parsing in parse_double helper.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-05-04 11:30:24 +02:00 committed by Alexandre Julliard
parent 19bff79da8
commit ab5e48f4fc
2 changed files with 9 additions and 1 deletions

View File

@ -744,7 +744,10 @@ double parse_double(MSVCRT_wchar_t (*get)(void *ctx), void (*unget)(void *ctx),
}
#endif
while(nch == '0') nch = get(ctx);
while(nch == '0') {
found_digit = TRUE;
nch = get(ctx);
}
b.data[0] = 0;
b.b = 0;

View File

@ -1956,6 +1956,11 @@ static void test__strtod(void)
{ "0.1D-4736", 9, 0 },
{ "3.4028234663852887e38", 21, FLT_MAX },
{ "1.7976931348623158e+308", 23, DBL_MAX },
{ "00", 2, 0 },
{ "00.", 3, 0 },
{ ".00", 3, 0 },
{ "-0.", 3, 0 },
{ "0e13", 4, 0 },
};
const char overflow[] = "1d9999999999999999999";