diff options
| author | JosJuice <josjuice@gmail.com> | 2020-01-03 23:27:39 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-06-17 13:43:52 +0200 |
| commit | 3c373c8aa82a6178993f8181c4621540141eb49e (patch) | |
| tree | 0184140cfc1c984e38b6886c36eb1c392dd77cd6 /Source/Core/DiscIO | |
| parent | 36991e2ddec67b97ba0306d13f90385f7748e72f (diff) | |
WIA: Treat groups with size 0 as containing only zeroes
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/WIABlob.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp index 6c56af5ad1..c6c1cae22e 100644 --- a/Source/Core/DiscIO/WIABlob.cpp +++ b/Source/Core/DiscIO/WIABlob.cpp @@ -246,12 +246,20 @@ bool WIAFileReader::ReadFromGroups(u64* offset, u64* size, u8** out_ptr, u64 chu const u64 group_offset = data_offset + i * chunk_size; const u64 offset_in_group = *offset - group_offset; - const u64 group_offset_in_file = static_cast<u64>(Common::swap32(group.data_offset)) << 2; const u64 bytes_to_read = std::min(chunk_size - offset_in_group, *size); - if (!ReadCompressedData(chunk_size, group_offset_in_file, Common::swap32(group.data_size), - offset_in_group, bytes_to_read, *out_ptr, exception_list)) + const u32 group_data_size = Common::swap32(group.data_size); + if (group_data_size == 0) { - return false; + std::memset(*out_ptr, 0, bytes_to_read); + } + else + { + const u64 group_offset_in_file = static_cast<u64>(Common::swap32(group.data_offset)) << 2; + if (!ReadCompressedData(chunk_size, group_offset_in_file, group_data_size, offset_in_group, + bytes_to_read, *out_ptr, exception_list)) + { + return false; + } } *offset += bytes_to_read; |
