mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
DiscIO: Add out of bounds checks for blob reading
This commit is contained in:
@ -375,6 +375,9 @@ DirectoryBlobReader::DirectoryBlobReader(const std::string& game_partition_root,
|
||||
|
||||
bool DirectoryBlobReader::Read(u64 offset, u64 length, u8* buffer)
|
||||
{
|
||||
if (offset + length > m_data_size)
|
||||
return false;
|
||||
|
||||
// TODO: We don't handle raw access to the encrypted area of Wii discs correctly.
|
||||
return (m_is_wii ? m_nonpartition_contents : m_gamecube_pseudopartition.GetContents())
|
||||
.Read(offset, length, buffer);
|
||||
@ -394,6 +397,9 @@ bool DirectoryBlobReader::ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64
|
||||
if (it == m_partitions.end())
|
||||
return false;
|
||||
|
||||
if (offset + size > it->second.GetDataSize())
|
||||
return false;
|
||||
|
||||
return it->second.GetContents().Read(offset, size, buffer);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user