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
Fix Gecko codes loading #8542
Fix Gecko codes loading #8542
Conversation
bc1b5cb
to
61b61cc
Compare
|
Do we know why this fixes it? It doesn't intuitively make sense to me. |
|
I can reproduce the problem using |
|
While searching where this behavior could come from, I stumbled upon this : So ... I am very lost about the true origin of this bug ... |
|
Okay, apparently certain locales allow spaces within a single formatted number. Both GeckoCode values are read as a single 64 bit hex value which overflows causing the issue. This is horrible. We probably assume formatted number input does not cross white space throughout dolphin. |
|
Well that's bad ... I can also fix DownloadCodes (so that the display just after download works), but if there are more places to fix I think it would be best for you to take over. |
Some locales (e.g. fr_FR.UTF-8 on ArchLinux) don't split the string stream on a space. As such, when extracted formatted data from te stream, it will return the two numbers as one for the first call, effectively overflowing the u32 variable, then will do an out-of-bounds read for the second call. Forcing the use of the C locale on the streams where it would cause a problem allows to workaround this behavior.
61b61cc
to
fe900e0
Compare
|
Updated to better reflect jordan-woyak's findings in the comments and the commit message, and to add the fix to DownloadCodes function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we should probably stop parsing things with stringstreams but I think this is a good quick fix for now to fix Gecko Codes.
Fixes https://bugs.dolphin-emu.org/issues/11809
I found on my system (Archlinux) that using a locale with UTF-8 was breaking loading of Gecko codes. Hopefully forcing the C locale on this string stream should be enough without breaking it on other systems.