(PkOpener): sanity check.

This commit is contained in:
morkt 2016-09-10 15:08:44 +04:00
parent 58d66c4210
commit d05bcef548

View File

@ -65,6 +65,8 @@ namespace GameRes.Formats.UMeSoft
if (name_len+14 > index_end-index_offset) if (name_len+14 > index_end-index_offset)
return null; return null;
string name = file.View.ReadString (index_offset, name_len); string name = file.View.ReadString (index_offset, name_len);
if (name.Length < (int)name_len / 2 + 1)
return null;
index_offset += name_len+6; index_offset += name_len+6;
var entry = FormatCatalog.Instance.Create<Entry> (name); var entry = FormatCatalog.Instance.Create<Entry> (name);
entry.Size = file.View.ReadUInt32 (index_offset); entry.Size = file.View.ReadUInt32 (index_offset);