mirror of
https://github.com/GerbilSoft/rvthtool.git
synced 2025-06-19 03:55:37 -04:00
[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:
parent
0ee8f055f9
commit
be979181cc
@ -407,6 +407,13 @@ int rvth_init_BankEntry_AppLoader(RvtH_BankEntry *entry)
|
|||||||
lba_start += BYTES_TO_LBA(data_offset);
|
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.
|
// Read the boot block and boot info.
|
||||||
// Start address: 0x420 (LBA 2)
|
// Start address: 0x420 (LBA 2)
|
||||||
lba_size = entry->reader->read(sector_buf, lba_start + 2, 1);
|
lba_size = entry->reader->read(sector_buf, lba_start + 2, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user