Skip to content
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

[Crash]: If the directory name contains multibyte characters, openTTD will crash. #12648

Open
koutya0125 opened this issue May 9, 2024 · 2 comments · May be fixed by #12650
Open

[Crash]: If the directory name contains multibyte characters, openTTD will crash. #12648

koutya0125 opened this issue May 9, 2024 · 2 comments · May be fixed by #12650

Comments

@koutya0125
Copy link

koutya0125 commented May 9, 2024

Version of OpenTTD

14.1,windows11

Steps to reproduce

1.Install openTTD in the multibyte character folder.
2.Start openTTD.

In countries that use multibyte characters (e.g., Japan), user folders and documents folders may be in multibyte characters.
Basically, even if a documents folder looks like it is in multibyte characters, the actual path is often in single-byte characters.
However, if the documents folder is in OneDrive, the actual path is also likely to be multibyte characters.
If only the documents folder is multibyte characters, it will crash when trying to download newGRF.

Upload crash files

crash20240509071908.zip

@koutya0125 koutya0125 changed the title [Crash]: If the directory name contains 2-byte characters, openTTD will crash. [Crash]: If the directory name contains multibyte characters, openTTD will crash. May 9, 2024
@glx22
Copy link
Contributor

glx22 commented May 9, 2024

 	openttd.exe!google_breakpad::ExceptionHandler::WriteMinidump(const std::wstring & dump_path, bool(*)(const wchar_t *, const wchar_t *, void *, _EXCEPTION_POINTERS *, MDRawAssertionInfo *, bool) callback, void * callback_context, _MINIDUMP_TYPE dump_type) Ligne 773	C++
 	openttd.exe!CrashLogWindows::WriteCrashDump() Ligne 113	C++
 	[Cadre en ligne] openttd.exe!std::_Func_class<bool>::operator()() Ligne 854	C++
 	openttd.exe!CrashLogWindows::TryExecute(std::basic_string_view<char,std::char_traits<char>> section_name, std::function<bool __cdecl(void)> && func) Ligne 124	C++
 	openttd.exe!CrashLog::MakeCrashLog() Ligne 294	C++
 	openttd.exe!ExceptionHandler(_EXCEPTION_POINTERS * ep) Ligne 341	C++
 	[Code externe]	
 	[Cadre en ligne] openttd.exe!std::filesystem::path::{ctor}(const std::string &) Ligne 655	C++
>	openttd.exe!TarScanner::AddFile(const std::string & filename, unsigned __int64 __formal, const std::string & tar_filename) Ligne 534	C++
 	openttd.exe!ScanPath(FileScanner * fs, const char * extension, const char * path, unsigned __int64 basepath_length, bool recursive) Ligne 1189	C++
 	openttd.exe!FileScanner::Scan(const char * extension, Subdirectory sd, bool tars, bool recursive) Ligne 1234	C++
 	openttd.exe!TarScanner::DoScan(Subdirectory sd) Ligne 433	C++
 	openttd.exe!TarScanner::DoScan(TarScanner::Mode mode) Ligne 443	C++
 	openttd.exe!openttd_main(int argc, char * * argv) Ligne 683	C++
 	openttd.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Ligne 85	C++
 	[Code externe]	

PeterN added a commit to PeterN/OpenTTD that referenced this issue May 9, 2024
…e encoding.

std::filesystem::path does not expect UTF-8 strings, so they must be converted to native format first (and back to utf-8 after.)
PeterN added a commit to PeterN/OpenTTD that referenced this issue May 9, 2024
…e encoding.

std::filesystem::path does not expect UTF-8 strings, so they must be converted to native format first (and back to utf-8 after.)
@glx22
Copy link
Contributor

glx22 commented May 9, 2024

Test build with a possible fix here

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 a pull request may close this issue.

2 participants