Do not use the cache if the read would result in OOB (#130)

This commit is contained in:
PabloMK7 2024-05-16 00:30:18 +02:00 committed by GitHub
parent 2e9d7bd208
commit 64e3e9ffaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -383,7 +383,7 @@ ResultVal<std::size_t> ArticFileBackend::Read(u64 offset, std::size_t length, u8
auto cache = cache_provider->ProvideCache(
client, cache_provider->PathsToVector(archive_path, file_path), true);
if (cache != nullptr) {
if (cache != nullptr && (offset + static_cast<u64>(length)) < GetSize()) {
return cache->Read(file_handle, offset, length, buffer);
}