mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-11 06:15:59 +01:00
Ubi DAT: Additional checks
This commit is contained in:
parent
e4eb650cfa
commit
8d2fcdbae3
@ -656,11 +656,19 @@ static int parse_dat_header(ubi_sb_header *sb, STREAMFILE *sf) {
|
|||||||
sb->section1_num = read_32bit(0x08, sf);
|
sb->section1_num = read_32bit(0x08, sf);
|
||||||
sb->section2_offset = read_32bit(0x0c, sf);
|
sb->section2_offset = read_32bit(0x0c, sf);
|
||||||
sb->section2_num = read_32bit(0x10, sf);
|
sb->section2_num = read_32bit(0x10, sf);
|
||||||
sb->section3_offset = read_32bit(0x14, sf);
|
sb->bank_size = read_32bit(0x14, sf);
|
||||||
sb->section3_num = 0;
|
|
||||||
|
if (sb->section1_offset != 0x18)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (sb->section2_offset != sb->section1_offset + sb->section1_num * sb->cfg.section1_entry_size)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (sb->bank_size != get_streamfile_size(sf))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
sb->sectionX_offset = sb->section2_offset + sb->section2_num * sb->cfg.section2_entry_size;
|
sb->sectionX_offset = sb->section2_offset + sb->section2_num * sb->cfg.section2_entry_size;
|
||||||
sb->sectionX_size = sb->section3_offset - sb->sectionX_offset;
|
sb->sectionX_size = sb->bank_size - sb->sectionX_offset;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
|
Loading…
Reference in New Issue
Block a user