Module: wine Branch: master Commit: ab5e48f4fc70debe2696b4047099e2cddd355954 URL: https://source.winehq.org/git/wine.git/?a=commit;h=ab5e48f4fc70debe2696b4047...
Author: Piotr Caban piotr@codeweavers.com Date: Mon May 4 11:30:24 2020 +0200
msvcrt: Fix 0 parsing in parse_double helper.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/string.c | 5 ++++- dlls/msvcrt/tests/string.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 31ed4e2181..407f819884 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -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; diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 9b26484592..46eb0cc080 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -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";