From this disassembly, %r8 (which is 'written' parameter) is saved on stack (`movq %r8, -0x68(%rbp)`), it is moved to %rdx in the end for assignment. I think it is likely that some code inside the fucntion before '*written' assignment smashes the stack and 'written' (and a whole change introduced by this patch) is a random victim.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8834#note_120934
The code in `req_write_process_memory` calling write_process_memory is:
```
...
if ((process = get_process_from_handle( req->handle, PROCESS_VM_WRITE )))
{
data_size_t len = get_req_data_size();
reply->written = 0;
if (len) write_process_memory( process, req->addr, len, get_req_data(), &reply->written );
release_object( process );
}
```
reply->written was just assigned and it didn't crash. However, address of that which got to `write_process_memory` is bogus.
Can it happen by any chance that something went wrong with the build, if not assuming some mindbreaking guesses or compiler errors that could happen if some compiled .o files are stale??
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8834#note_120932
Fixes: 2127e9ae7d90466f3b8883708799047214409832
---
Fixes a crash on macOS. Perhaps the extensions string regularly has a trailing space on other platforms?
The previous filter_extensions_list method set `end` differently and avoided this case.
--
v4: opengl32: Avoid null pointer dereferences when filtering extensions.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9375
relevant bug reports:
- https://bugs.winehq.org/show_bug.cgi?id=41712
- https://bugs.winehq.org/show_bug.cgi?id=51051
--
v19: ntoskrnl: move i386 specific Rtl*ByteSwap() into separate source.
ntoskrnl: move _chkstk() / __chkstk() into separate source.
msvcrt: move i386 specific _ftol() into separate source.
kernel32: move x86-64 specific GetProcAddress() into separate source.
kernel32: move i386 specific Interlocked*() into separate source.
kernel32: move i386 specific ExitProcess() into separate source.
kernelbase: move x86-64 specific GetProcAddress() into separate source.
ntdll: move i386 specific Rtl*ByteSwap() into separate source.
tools: add LTO quirks.
makedep: support skipping/disabling LTO.
configure: enable building Wine with LTO.
makedep: support LTO builds.
winegcc: support LTO builds.
winebuild: support LTO builds.
tools: helper functions for LTO builds.
ntdll: add attribute "used" to a few symbols that should not be discarded.
loader: add attribute "used" to a few symbols that should not be discarded.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7111