https://bugs.winehq.org/show_bug.cgi?id=56941
Bug ID: 56941 Summary: EA app fails to launch game if total size of environment variables exceeds ~32000 characters Product: Wine Version: 9.12 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: tinozzo123@gmail.com Distribution: ---
### Steps to reproduce
Preparation: - Have the EA app installed: https://origin-a.akamaihd.net/EA-Desktop-Client-Download/installer-releases/... - I installed it through Bottles, which installs the following Winetricks dependencies: https://github.com/bottlesdevs/programs/blob/main/Games/eaclient.yml
Reproducing: - Set a very long environment variable, before launching the EA app - From the EA app, launch any game - Alternatively, execute the game directly, it will automatically launch the EA app to launch the game - If you don't have any game, "The Sims 4" is free - The game won't launch, an error popup from the EA app will appear (see notes)
### Notes
It doesn't matter whether these ~32000 characters are from a single environment variable, or from the combination of many of them.
I didn't test on Windows. It may be impossible to test there, since the environment block there has a limit of 32760 characters (which may probably be the reason for this issue in the first place).
I say "~32000", because the issue starts occurring a little before 32760 characters. However, my counting method was imprecise (I simply typed `set` in `wine cmd`, then counted the characters), and there's also the fact that the EA app also sets its own environment variables.
The issue also occurs with games bought from Steam (thus launched with Proton) that also have to go through the EA app (thanks EA).
This issue existed before, and the weird thing is that the error popup from the EA app is different from some time ago (I imagine due to the app being updated). Before it was: "Failed to launch game. An error on our end caused the launch to fail. Try again a little later." Now it's: "The game hasn't released yet" (which is obviously untrue). Is it a stack overflow issue?
Logs obtained with `WINEDEBUG=EADesktop.exe:+relay` are too big to attach, even compressed. Let me know what `WINEDEBUG` parameters I should use instead. I can see that the app calls `GetEnvironmentStringsW`, shortly followed by a `WideCharToMultiByte` for each variable (key and value separately). This is done three times.