Service/AM: Fix crash when scanning titles with installed titles with invalid title IDs (#3542)
* Service/AM: Fix crash when scanning titles with installed titles with invalid title IDs Fixes #3332
This commit is contained in:
parent
327ad8bcce
commit
e2c5666883
2 changed files with 11 additions and 5 deletions
|
@ -456,6 +456,8 @@ void Module::ScanForTitles(Service::FS::MediaType media_type) {
|
||||||
for (const FileUtil::FSTEntry& tid_high : entries.children) {
|
for (const FileUtil::FSTEntry& tid_high : entries.children) {
|
||||||
for (const FileUtil::FSTEntry& tid_low : tid_high.children) {
|
for (const FileUtil::FSTEntry& tid_low : tid_high.children) {
|
||||||
std::string tid_string = tid_high.virtualName + tid_low.virtualName;
|
std::string tid_string = tid_high.virtualName + tid_low.virtualName;
|
||||||
|
|
||||||
|
if (tid_string.length() == TITLE_ID_VALID_LENGTH) {
|
||||||
u64 tid = std::stoull(tid_string.c_str(), nullptr, 16);
|
u64 tid = std::stoull(tid_string.c_str(), nullptr, 16);
|
||||||
|
|
||||||
FileSys::NCCHContainer container(GetTitleContentPath(media_type, tid));
|
FileSys::NCCHContainer container(GetTitleContentPath(media_type, tid));
|
||||||
|
@ -463,6 +465,7 @@ void Module::ScanForTitles(Service::FS::MediaType media_type) {
|
||||||
am_title_list[static_cast<u32>(media_type)].push_back(tid);
|
am_title_list[static_cast<u32>(media_type)].push_back(tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::ScanForAllTitles() {
|
void Module::ScanForAllTitles() {
|
||||||
|
|
|
@ -52,7 +52,10 @@ enum class InstallStatus : u32 {
|
||||||
ErrorEncrypted,
|
ErrorEncrypted,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Progress callback for InstallCIA, recieves bytes written and total bytes
|
// Title ID valid length
|
||||||
|
constexpr size_t TITLE_ID_VALID_LENGTH = 16;
|
||||||
|
|
||||||
|
// Progress callback for InstallCIA, receives bytes written and total bytes
|
||||||
using ProgressCallback = void(size_t, size_t);
|
using ProgressCallback = void(size_t, size_t);
|
||||||
|
|
||||||
// A file handled returned for CIAs to be written into and subsequently installed.
|
// A file handled returned for CIAs to be written into and subsequently installed.
|
||||||
|
|
Loading…
Reference in a new issue