summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHecklezz <tj8@live.com.au>2026-09-09 07:56:55 +1000
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-09-09 20:45:59 +0300
commit79e54cc404c679c7cce1c0a9ace4728f8e99b5b8 (patch)
treee57fa028c8879c02276aea952182edbbe53b60a6
parentbd6296230bf977ca0e12503976f19c61131edfb2 (diff)
Fix crash loading chatlogs with unicode in the names
-rw-r--r--indra/llfilesystem/lldir.cpp24
-rw-r--r--indra/llfilesystem/lldiriterator.cpp21
2 files changed, 33 insertions, 12 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index 756d09e69a..37c6f61a05 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -98,15 +98,29 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
if (std::filesystem::is_directory(dir_path, ec))
{
std::filesystem::directory_iterator end_iter;
- for (std::filesystem::directory_iterator dir_itr(dir_path);
- dir_itr != end_iter;
- ++dir_itr)
+ try
{
- if (std::filesystem::is_regular_file(dir_itr->status()))
+ for (std::filesystem::directory_iterator dir_itr(dir_path);
+ dir_itr != end_iter;
+ ++dir_itr)
{
- v.push_back(dir_itr->path().filename().string());
+ try
+ {
+ if (std::filesystem::is_regular_file(dir_itr->status()))
+ {
+ v.push_back(fsyspath(dir_itr->path().filename()).string());
+ }
+ }
+ catch (const std::system_error& e)
+ {
+ LL_WARNS() << "Exception accessing directory entry: " << e.what() << LL_ENDL;
+ }
}
}
+ catch (const std::system_error& e)
+ {
+ LL_WARNS() << "Exception iterating directory: " << e.what() << LL_ENDL;
+ }
}
return v;
}
diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp
index 60b55c7bf3..ca00d25fb7 100644
--- a/indra/llfilesystem/lldiriterator.cpp
+++ b/indra/llfilesystem/lldiriterator.cpp
@@ -126,20 +126,27 @@ bool LLDirIterator::Impl::next(std::string &fname)
{
while (mIter != end_itr && !found)
{
- boost::smatch match;
- std::string name = mIter->path().filename().string();
- found = ll_regex_match(name, match, mFilterExp);
- if (found)
+ try
{
- fname = name;
+ boost::smatch match;
+ std::string name = fsyspath(mIter->path().filename()).string();
+ found = ll_regex_match(name, match, mFilterExp);
+ if (found)
+ {
+ fname = name;
+ }
+ }
+ catch (const std::system_error& e)
+ {
+ LL_WARNS() << "Exception accessing directory entry: " << e.what() << LL_ENDL;
}
++mIter;
}
}
- catch (const fs::filesystem_error& e)
+ catch (const std::system_error& e)
{
- LL_WARNS() << e.what() << LL_ENDL;
+ LL_WARNS() << "Exception iterating directory: " << e.what() << LL_ENDL;
}
return found;