Improve ELF/Trophy loader's error checking

This commit is contained in:
Eladash 2021-03-21 07:03:21 +02:00 committed by Ivan
parent a67b347966
commit 2f333424a6
6 changed files with 61 additions and 53 deletions

View file

@ -1556,6 +1556,17 @@ bool fs::dir::open(const std::string& path)
return true;
}
bool fs::file::strict_read_check(u64 _size, u64 type_size) const
{
if (usz pos0 = pos(), size0 = size(); pos0 >= size0 || (size0 - pos0) / type_size < _size)
{
fs::g_tls_error = fs::error::inval;
return false;
}
return true;
}
const std::string& fs::get_config_dir()
{
// Use magic static