correctly check reserved view size.

This commit is contained in:
morkt 2014-08-02 00:42:59 +04:00
parent 116344ee9b
commit 13674f2e11
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ namespace GameRes.Formats.Majiro
table_size *= 4 * (version+1); table_size *= 4 * (version+1);
if (table_size + 0x1c != names_offset) if (table_size + 0x1c != names_offset)
return null; return null;
if (data_offset != file.View.Reserve (0, data_offset)) if (data_offset > file.View.Reserve (0, data_offset))
return null; return null;
int names_size = (int)(data_offset - names_offset); int names_size = (int)(data_offset - names_offset);
var names = new byte[names_size]; var names = new byte[names_size];

View File

@ -58,7 +58,7 @@ namespace GameRes.Formats
uint dir_size = file.View.ReadUInt32 (12); uint dir_size = file.View.ReadUInt32 (12);
if (dir_size < count * 0x17 || count > 0xfffff) if (dir_size < count * 0x17 || count > 0xfffff)
return null; return null;
if (dir_size != file.View.Reserve (0x20, dir_size)) if (dir_size > file.View.Reserve (0x20, dir_size))
return null; return null;
var parser = new Parser (file, version, count, dir_size); var parser = new Parser (file, version, count, dir_size);