Hi,
This patch fixes a crash in IL-2 Sturmovik: Battle of Stanlingrad (with some other tweaks the game runs well). Without this, the game crashes when starting a mission:
Unhandled exception: page fault on write access to 0x1408b81bc in 64-bit code (0x00007f783f3ad8e4). ... Backtrace: =>0 0x00007f783f3ad8e4 MSVCRT__strlwr_s_l+0x64() in ucrtbase (0x000000004a77ccf0) 1 0x00007f783f3ad96f MSVCRT__strlwr+0x1e(str="idle") [Z:\build\wine-4.16\dlls\ucrtbase..\msvcrt\string.c:111] in ucrtbase (0x000000004a77cd30) 2 0x000000014045a782 EntryPoint+0xffbf1fd1() in il-2 (0x000000004a77cee0) 0x00007f783f3ad8e4 MSVCRT__strlwr_s_l+0x64 in ucrtbase: movb %al,0xffffffffffffffff(%rbx)
Based on this backtrace, my hypothesis was that the game is calling strlwr on a read-only string that is already lower-case. I have then changed strlwr to not assign characters to the string when the value is unchanged, which fixed the crash. To me this is sufficient evidence to confirm the hypothesis.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=60973
Your paranoid android.
=== wxppro (32 bit report) ===
msvcrt: 09dc:string: unhandled exception c0000005 at 77C4675F
=== w2003std (32 bit report) ===
msvcrt: 01e8:string: unhandled exception c0000005 at 77BD75CF
=== wvistau64 (32 bit report) ===
msvcrt: 02d8:string: unhandled exception c0000005 at 7655C22D
=== w2008s64 (32 bit report) ===
msvcrt: 05bc:string: unhandled exception c0000005 at 74CAC22D
=== w7u (32 bit report) ===
msvcrt: 0d50:string: unhandled exception c0000005 at 7618F5A3
=== w8 (32 bit report) ===
msvcrt: 0e8c:string: unhandled exception c0000005 at 7784E2EE
=== w8adm (32 bit report) ===
msvcrt: 0cd8:string: unhandled exception c0000005 at 7558E2EE
=== w864 (32 bit report) ===
msvcrt: 07dc:string: unhandled exception c0000005 at 7745E2EE
=== w1064v1507 (32 bit report) ===
msvcrt: 0780:string: unhandled exception c0000005 at 74268F3E
=== w1064v1809 (32 bit report) ===
msvcrt: 194c:string: unhandled exception c0000005 at 767BABAE
=== w1064v1809_2scr (32 bit report) ===
msvcrt: 1a48:string: unhandled exception c0000005 at 76D7ABAE
=== w1064v1809_ar (32 bit report) ===
msvcrt: 181c:string: unhandled exception c0000005 at 75D9ABAE
=== w1064v1809_he (32 bit report) ===
msvcrt: 0ffc:string: unhandled exception c0000005 at 7581ABAE
=== w1064v1809_ja (32 bit report) ===
msvcrt: 0d84:string: unhandled exception c0000005 at 75DCABAE
=== w1064v1809_zh_CN (32 bit report) ===
msvcrt: 1900:string: unhandled exception c0000005 at 773CABAE
=== wvistau64 (64 bit report) ===
msvcrt: 02d8:string: unhandled exception c0000005 at 000007FEFF413A67
=== w2008s64 (64 bit report) ===
msvcrt: 0390:string: unhandled exception c0000005 at 000007FEFDED3A67
=== w864 (64 bit report) ===
msvcrt: 045c:string: unhandled exception c0000005 at 00007FF9E4D5582E
=== w1064v1507 (64 bit report) ===
msvcrt: 0c98:string: unhandled exception c0000005 at 00007FF8C983C5DA
=== w1064v1809 (64 bit report) ===
msvcrt: 1930:string: unhandled exception c0000005 at 00007FF871DED60A
Hi Ambrož,
As you have probably seen, the tests are crashing on Windows. If you need any hints - the function behaves in the way you have implemented only in C locale.
Thanks, Piotr