[PATCH] msvcrt: Make strlwr/strupr write to the string only if necessary.
abizjak.pro at gmail.com
Wed Nov 27 12:56:11 CST 2019
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).
=>0 0x00007f783f3ad8e4 MSVCRT__strlwr_s_l+0x64() in ucrtbase
1 0x00007f783f3ad96f MSVCRT__strlwr+0x1e(str="idle")
[Z:\build\wine-4.16\dlls\ucrtbase\..\msvcrt\string.c:111] in ucrtbase
2 0x000000014045a782 EntryPoint+0xffbf1fd1() in il-2 (0x000000004a77cee0)
0x00007f783f3ad8e4 MSVCRT__strlwr_s_l+0x64 in ucrtbase: movb
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2930 bytes
Desc: not available
More information about the wine-devel