(DatOpener): additional sanity check.

This commit is contained in:
morkt 2016-01-21 15:30:32 +04:00
parent dbd95d62e3
commit c8a656e172

View File

@ -52,7 +52,8 @@ namespace GameRes.Formats.MnoViolet
return null; return null;
uint name_size = 100; uint name_size = 100;
uint index_size = (uint)((name_size+8) * count); uint index_size = (uint)((name_size+8) * count);
if (index_size > file.View.Reserve (4, index_size)) uint first_offset = file.View.ReadUInt32 (4+name_size+4);
if (first_offset != (4 + index_size) || index_size > file.View.Reserve (4, index_size))
return null; return null;
var dir = new List<Entry> (count); var dir = new List<Entry> (count);
long index_offset = 4; long index_offset = 4;