mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-30 17:05:37 +08:00
additional sanity checks to reduce false positive detections.
This commit is contained in:
parent
ea75aa558b
commit
919ef22202
@ -66,6 +66,8 @@ namespace GameRes.Formats.Cherry
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
string name = file.View.ReadString (index_offset, 0x10);
|
||||
if (0 == name.Length)
|
||||
return null;
|
||||
var offset = base_offset + file.View.ReadUInt32 (index_offset+0x10);
|
||||
Entry entry;
|
||||
if (is_grp)
|
||||
|
@ -48,7 +48,7 @@ namespace GameRes.Formats.Circus
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (count <= 0 || count > 0xfffff)
|
||||
if (count <= 1 || count > 0xfffff)
|
||||
return null;
|
||||
var dir = ReadIndex (file, count, 0x30);
|
||||
if (null == dir)
|
||||
|
@ -35,7 +35,7 @@ namespace GameRes.Formats.KAAS
|
||||
public class PdOpener : ArchiveFormat
|
||||
{
|
||||
public override string Tag { get { return "PD/KAAS"; } }
|
||||
public override string Description { get { return "KAAS engine resource archive"; } }
|
||||
public override string Description { get { return "KAAS engine PD resource archive"; } }
|
||||
public override uint Signature { get { return 0; } }
|
||||
public override bool IsHierarchic { get { return false; } }
|
||||
public override bool CanCreate { get { return false; } }
|
||||
@ -100,7 +100,7 @@ namespace GameRes.Formats.KAAS
|
||||
public class PbOpener : ArchiveFormat
|
||||
{
|
||||
public override string Tag { get { return "PB"; } }
|
||||
public override string Description { get { return "KAAS engine resource archive"; } }
|
||||
public override string Description { get { return "KAAS engine PB resource archive"; } }
|
||||
public override uint Signature { get { return 0; } }
|
||||
public override bool IsHierarchic { get { return false; } }
|
||||
public override bool CanCreate { get { return false; } }
|
||||
@ -113,6 +113,7 @@ namespace GameRes.Formats.KAAS
|
||||
var dir = new List<Entry> (count);
|
||||
int index_offset = 0x10;
|
||||
bool is_voice = Path.GetFileName (file.Name).Equals ("voice.pb", StringComparison.InvariantCultureIgnoreCase);
|
||||
int data_offset = index_offset + 8 * count;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
uint offset = file.View.ReadUInt32 (index_offset);
|
||||
@ -122,7 +123,7 @@ namespace GameRes.Formats.KAAS
|
||||
else
|
||||
entry = new Entry { Name = string.Format ("{0:D4}.pb", i), Type = "archive", Offset = offset };
|
||||
entry.Size = file.View.ReadUInt32 (index_offset + 4);
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
if (offset < data_offset || !entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
dir.Add (entry);
|
||||
index_offset += 8;
|
||||
|
Loading…
Reference in New Issue
Block a user