GzippedFileReader: Don't write OOB in last chunk

zlib_indexed can write the full span to the block, despite the length being shorter. This code can die in a fire.

Closes #11398.
This commit is contained in:
Connor McLaughlin 2024-06-15 17:42:56 +10:00 committed by GitHub
parent 9c57ac34e3
commit 6fcd5d0aff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -223,7 +223,7 @@ ThreadedFileReader::Chunk GzippedFileReader::ChunkForOffset(u64 offset)
else
{
chunk.chunkID = static_cast<s64>(offset) / m_index->span;
chunk.length = static_cast<u32>(std::min<u64>(m_index->uncompressed_size - offset, m_index->span));
chunk.length = m_index->span;
chunk.offset = static_cast<u64>(chunk.chunkID) * m_index->span;
}