diff options
| author | Tilka <tilkax@gmail.com> | 2020-01-15 13:48:00 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-15 13:48:00 +0000 |
| commit | 1cc7ef356b9a33814efb290368150a1cceb0a3ed (patch) | |
| tree | 3033a500319e754fb089ff22bc9bd89a40c41d2e /Source/Core/DiscIO/DirectoryBlob.cpp | |
| parent | 1ac3264d5d5c21b6b5ac9eb5a756e7cf142423c8 (diff) | |
| parent | 297b790e4f14be284df39d5ac67e59527df41e29 (diff) | |
Merge pull request #8558 from JosJuice/volume-oob
DiscIO: Add out of bounds checks for blob reading
Diffstat (limited to 'Source/Core/DiscIO/DirectoryBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/DirectoryBlob.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index 723133fd8b..514fdc7c44 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -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); } |
