[librvth] rvth_init_BankEntry_AppLoader(): Verify that lba_start is in range.

Corrupted disk images could put it out of range, resulting in an
assertion failure.
This commit is contained in:
David Korth 2022-08-07 20:06:18 -04:00
parent 0ee8f055f9
commit be979181cc

View File

@ -407,6 +407,13 @@ int rvth_init_BankEntry_AppLoader(RvtH_BankEntry *entry)
lba_start += BYTES_TO_LBA(data_offset);
}
// Sanity check: If the disc image is invalid,
// data offset might be out of range.
if (lba_start + 2 >= entry->lba_len) {
// Out of range.
return -EIO;
}
// Read the boot block and boot info.
// Start address: 0x420 (LBA 2)
lba_size = entry->reader->read(sector_buf, lba_start + 2, 1);