mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
Merge pull request #718 from lioncash/read
loader/nso: Check if read succeeded in IdentifyFile() before checking magic value
This commit is contained in:
commit
dd0446ff43
@ -55,13 +55,15 @@ AppLoader_NSO::AppLoader_NSO(FileSys::VirtualFile file) : AppLoader(std::move(fi
|
|||||||
|
|
||||||
FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) {
|
FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) {
|
||||||
u32 magic = 0;
|
u32 magic = 0;
|
||||||
file->ReadObject(&magic);
|
if (file->ReadObject(&magic) != sizeof(magic)) {
|
||||||
|
return FileType::Error;
|
||||||
if (Common::MakeMagic('N', 'S', 'O', '0') == magic) {
|
|
||||||
return FileType::NSO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileType::Error;
|
if (Common::MakeMagic('N', 'S', 'O', '0') != magic) {
|
||||||
|
return FileType::Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileType::NSO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
||||||
|
Loading…
Reference in New Issue
Block a user