[PATCH 0/1] MR4829: msvcrt: Protect setlocale against concurrent accesses.
From: Bernhard Übelacker <bernhardu(a)mailbox.org> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55467 --- dlls/msvcrt/locale.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index f7be2a1e9bc..99612edfa3e 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -2036,6 +2036,7 @@ char* CDECL setlocale(int category, const char* locale) { thread_data_t *data = msvcrt_get_thread_data(); pthreadlocinfo locinfo = get_locinfo(), newlocinfo; + int locale_flags; if(category<LC_MIN || category>LC_MAX) return NULL; @@ -2047,7 +2048,11 @@ char* CDECL setlocale(int category, const char* locale) return locinfo->lc_category[category].locale; } + /* Make sure that locinfo is not updated by e.g. stricmp function */ + locale_flags = data->locale_flags; + data->locale_flags |= LOCALE_THREAD; newlocinfo = create_locinfo(category, locale, locinfo); + data->locale_flags = locale_flags; if(!newlocinfo) { WARN("%d %s failed\n", category, locale); return NULL; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4829
This merge request was approved by Piotr Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4829
This MR contains updated patch from !4654. It turns out that the application from bug 55467 worked in wine-5.0. @gofman was also reporting similar regression in proton. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4829#note_57308
participants (2)
-
Bernhard Übelacker -
Piotr Caban (@piotr)