https://bugs.winehq.org/show_bug.cgi?id=44405
--- Comment #11 from Richard Yao ryao@gentoo.org --- Created attachment 62204 --> https://bugs.winehq.org/attachment.cgi?id=62204 This fixes the segfault.
I took a peek at this and I understand what is wrong. This commit was incorrect when it was done 9 years ago:
https://source.winehq.org/git/wine.git/commitdiff/2d5ac92d9a6878785158301b90...
BinaryToBase64W() will invoke `encodeBase64W(pbBinary, cbBinary, sep, NULL, &charsNeeded);` The NULL becomes `out_buf` in `encodeBase64W()`. It then invokes `ptr = out_buf;`, followed by:
*ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
That is our NULL pointer dereference. The only way this code could have worked would be if the caller did something wrong, causing it to exit early with ERROR_INSUFFICIENT_BUFFER.
When invoked with a NULL, the correct thing to do appears to be to return early because it looks like the code just wants a calculation to be done of how much space is actually needed. I have written and tested a small patch designed to do this and it makes the game work.