GDI's and gdrom CHD's must have at least 3 tracks

This commit is contained in:
Flyinghead 2023-01-10 11:28:42 +01:00
parent 285655f52d
commit 8a1902e5a8
2 changed files with 10 additions and 3 deletions

View File

@ -203,11 +203,14 @@ void CHDDisc::tryOpen(const char* file)
tracks.push_back(t);
}
if (isGdrom && (total_frames != 549300 || tracks.size() < 3))
WARN_LOG(GDROM, "WARNING: chd: Total GD-Rom frames is wrong: %u frames (549300 expected) in %zu tracks", total_frames, tracks.size());
if (isGdrom)
{
if (total_frames != 549300)
WARN_LOG(GDROM, "WARNING: chd: Total GD-Rom frames is wrong: %u frames (549300 expected) in %zu tracks", total_frames, tracks.size());
if (tracks.size() < 3)
throw FlycastException("Invalid CHD: less than 3 tracks");
FillGDSession();
}
else
{
type = CdRom_XA;

View File

@ -158,6 +158,10 @@ Disc* load_gdi(const char* file, std::vector<u8> *digest)
disc->tracks.push_back(t);
}
if (disc->tracks.size() < 3) {
delete disc;
throw FlycastException("GDI parse error: less than 3 tracks");
}
disc->FillGDSession();
if (digest != nullptr)
*digest = md5.getDigest();