AirGuanZ / imgui-filebrowser

File browser implementation for dear-imgui. C++17 is required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when opening a directory containing a file with a weird character in its extension

TheEeveeLovers opened this issue ยท comments

commented

What I've done to isolate the issue:

  • I added a file named sequence.๐Ÿ—ฟ to another folder | ERROR
  • I added a png to another folder, then appended ๐Ÿ—ฟ to the file extension. I then opened the new folder. | ERROR
  • I made the file with ๐Ÿ—ฟ in the filename instead of the extension. | NO ERROR

The exception in question:
Unhandled exception at 0x00007FF83338CF19 in program.exe: Microsoft C++ exception: std::system_error at memory location 0x000000B6F7F0CC38.

Call Stack:
KernelBase.dll!00007ff83338cf19()	Unknown

vcruntime140d.dll!00007fffe523b760()	Unknown

program.exe!std::_Throw_system_error_from_std_win_error(const __std_win_error _Errno) Line 65	C++

program.exe!std::_Check_convert_result(const __std_fs_convert_result _Result) Line 72	C++

program.exe!std::_Convert_wide_to_narrow<std::char_traits<char>,std::allocator<char>>(const __std_code_page _Code_page, const std::basic_string_view<wchar_t,std::char_traits<wchar_t>> _Input, const std::allocator<char> & _Al) Line 85	C++

program.exe!std::filesystem::_Convert_wide_to<std::char_traits<char>,std::allocator<char>,char>(const std::basic_string_view<wchar_t,std::char_traits<wchar_t>> _Input, const std::allocator<char> & _Al) Line 152	C++

program.exe!std::filesystem::path::string<char,std::char_traits<char>,std::allocator<char>,0>(const std::allocator<char> & _Al) Line 931	C++

program.exe!std::filesystem::path::string() Line 935	C++

program.exe!ImGui::FileBrowser::IsExtensionMatched(const std::filesystem::path & _extension) Line 890	C++

program.exe!ImGui::FileBrowser::Display() Line 515	C++

program.exe!SDL_main(int argc, char * * args) Line 156	C++

program.exe!main_getcmdline() Line 82	C

[External Code]	

Looking at the call stack and using context, the problem most likely lies in ImGui::FileBrowser::IsExtensionMatched()

commented

Looks like this is caused by windows error 1113 (no mapping for the unicode character exists in the target multi-byte code page) in the implementation of std::filesystem::path::string. I will fix it soon.

commented

Please try the new version

commented

Works fine now!