fs::file: always use strict reading mode for large reads (#11206)

This commit is contained in:
Eladash 2021-12-01 18:09:07 +02:00 committed by GitHub
parent f910a152f1
commit f16949c292
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 69 deletions

View file

@ -1658,7 +1658,7 @@ bool fs::dir::open(const std::string& path)
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)
if (usz pos0 = pos(), size0 = size(); (pos0 >= size0 ? 0 : (size0 - pos0)) / type_size < _size)
{
fs::g_tls_error = fs::error::inval;
return false;