mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
additional sanity checks to reduce false positives.
This commit is contained in:
@@ -43,7 +43,7 @@ namespace GameRes.Formats.CandySoft
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (count <= 0 || count > 0xfffff)
|
||||
if (!IsSaneCount (count))
|
||||
return null;
|
||||
List<Entry> dir = null;
|
||||
try
|
||||
@@ -68,6 +68,8 @@ namespace GameRes.Formats.CandySoft
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
string name = file.View.ReadString (index_offset+8, (uint)name_size);
|
||||
if (0 == name.Length)
|
||||
return null;
|
||||
var entry = FormatCatalog.Instance.Create<Entry> (name);
|
||||
entry.Offset = file.View.ReadUInt32 (index_offset);
|
||||
entry.Size = file.View.ReadUInt32 (index_offset+4);
|
||||
|
||||
Reference in New Issue
Block a user