mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-09-18 10:50:05 +00:00
GCZ: Don't trust block_num either
SectorReader::ReadChunk does do some validation on it, but it only checks against the original disc size (reported by the GCZ file). It has no idea how many blocks the header claimed the disc had. A maliciously crafted GCZ file could trigger read overflows off the end of the m_block_pointers/m_hashes arrays.
This commit is contained in:
@@ -94,6 +94,9 @@ u64 CompressedBlobReader::GetBlockCompressedSize(u64 block_num) const
|
||||
|
||||
bool CompressedBlobReader::GetBlock(u64 block_num, u8* out_ptr)
|
||||
{
|
||||
if (block_num >= m_header.num_blocks)
|
||||
return false;
|
||||
|
||||
bool uncompressed = false;
|
||||
u64 read_size = GetBlockCompressedSize(block_num);
|
||||
u64 offset = m_block_pointers[block_num] + m_data_offset;
|
||||
|
||||
Reference in New Issue
Block a user