Merge pull request #8619 from JosJuice/directoryblob-check-seek

DiscIO: Check for DirectoryBlob seek failure
This commit is contained in:
Léo Lam 2020-02-09 15:49:37 +01:00 committed by GitHub
commit 166e86b97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -104,8 +104,7 @@ bool DiscContent::Read(u64* offset, u64* length, u8** buffer) const
if (std::holds_alternative<std::string>(m_content_source)) if (std::holds_alternative<std::string>(m_content_source))
{ {
File::IOFile file(std::get<std::string>(m_content_source), "rb"); File::IOFile file(std::get<std::string>(m_content_source), "rb");
file.Seek(offset_in_content, SEEK_SET); if (!file.Seek(offset_in_content, SEEK_SET) || !file.ReadBytes(*buffer, bytes_to_read))
if (!file.ReadBytes(*buffer, bytes_to_read))
return false; return false;
} }
else else