(UsfOpener): additional sanity check.

This commit is contained in:
morkt 2018-01-02 06:20:14 +04:00
parent 466fec5ff8
commit a70cc6a251

View File

@ -45,7 +45,7 @@ namespace GameRes.Formats.WestGate
public override ArcFile TryOpen (ArcView file) public override ArcFile TryOpen (ArcView file)
{ {
uint first_offset = file.View.ReadUInt32 (0xC); uint first_offset = file.View.ReadUInt32 (0xC);
if (first_offset >= file.MaxOffset) if (first_offset >= file.MaxOffset || 0 != (first_offset & 0xF))
return null; return null;
int count = (int)(first_offset / 0x10); int count = (int)(first_offset / 0x10);
if (!IsSaneCount (count)) if (!IsSaneCount (count))