Skip to content

[GEN][ZH] Fix crash on russian replay load when DEBUG_CRASHING is enabled #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

helmutbuhler
Copy link

When AsciiString::format is called with format %ls it is supposed to convert Unicode to Ascii. When that conversion fails AsciiString::format throws an exception which results in a serious error.

Long term we should fix this by using UTF-8 everywhere, but for now using AsciiString::translate fixes the problem.

Note that this crash only occurs in debug build and is therefore no problem for retail version. Also the display of the version in the replay menu works fine, just this debug code for an assertion is crashing.

Here is a replay to test:
00-00-01_3v3_DESKTOPT_DESKTOPS_DESKTOPG_MediAI_MediAI_MediAI.zip

@xezon
Copy link

xezon commented May 7, 2025

So this is just a workaround for the problem? What would be the correct fix then?

@helmutbuhler
Copy link
Author

The proper fix would be to treat AsciiString as UTF-8 everywhere. Then DEBUG_ASSERTCRASH could be used to display the version mismatch without dataloss.
The entire codebase also needs to be cleaned up in the sense that UTF-8 should be used everywhere expect for places like Windows-API and dataloading. Because we don't need to support Windows ME and below (which didn't have support for the W function calls) we should also consistently use the Unicode version of all API calls.

But that's quite a big task. For now this PR just fixes a crash in debug output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants