Module: wine Branch: stable Commit: d3eecb9bf24fb8b5fc5141f28b006dcc6e89fc60 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d3eecb9bf24fb8b5fc5141f28... Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat Mar 16 14:49:08 2019 +0100 msvcrt: Don't detect overflow in atol implementation. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46845 Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 8c1684a50a56bdafe38fa5c685f6b367f8a44bc5) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/msvcrt/string.c | 4 ++++ dlls/msvcrt/tests/string.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index fc827d8..6751cf0 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -1109,7 +1109,11 @@ MSVCRT_long CDECL MSVCRT__atol_l(const char *str, MSVCRT__locale_t locale) */ MSVCRT_long CDECL MSVCRT_atol(const char *str) { +#if _MSVCR_VER == 0 + return MSVCRT_atoi(str); +#else return MSVCRT__atol_l(str, NULL); +#endif } #if _MSVCR_VER>=120 diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index a159132..4af55e5 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -3047,6 +3047,23 @@ static void test_atoi(void) ok(r == 0, "atoi(4294967296) = %d\n", r); } +static void test_atol(void) +{ + int r; + + r = atol("0"); + ok(r == 0, "atol(0) = %d\n", r); + + r = atol("-1"); + ok(r == -1, "atol(-1) = %d\n", r); + + r = atol("1"); + ok(r == 1, "atol(1) = %d\n", r); + + r = atol("4294967296"); + ok(r == 0, "atol(4294967296) = %d\n", r); +} + static void test_atof(void) { double d; @@ -3802,6 +3819,7 @@ START_TEST(string) test__stricmp(); test__wcstoi64(); test_atoi(); + test_atol(); test_atof(); test_strncpy(); test_strxfrm();