https://bugs.winehq.org/show_bug.cgi?id=54857
Bug ID: 54857 Summary: Gecko engine initialization changes current C run-time locale Product: Wine Version: 8.6 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: mshtml Assignee: wine-bugs@winehq.org Reporter: dmitry@baikal.ru Distribution: ---
The application that I have here crashes after the call ucrtbase._strupr("SOME STRING") Accoring to dlls/msvcrt/string.c _strupr() implementation avoids writing to the source buffer if the buffer contains upper case characters and current locale is "C". dlls/msvcrt/tests/string.c,test__strupr() contains a test case that confirms this behaviour.
According to the logs before calling ucrtbase._strupr("SOME STRING") application loads mshtml.dll, then xul.dll gets loaded which during its initialization calls ucrtbase.setlocale(0, ""), and that leads to the current C locale change.
I've created a test case that replicates this behaviour, and under Windows the test completes successfully, however under Wine it crashes. Adding a call to setlocale(0, "") also makes the test crash under Windows, so Wine implementation of _strupr() appears to be correct.
A possible solution is to save current locale before xul.dll initialization and later restore the locale.
I'll attach a test case and a patch with proposed solution to this bug report.