mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(ArcOpener.TryOpen): additional count sanity check.
This commit is contained in:
parent
ae900e22ea
commit
9371221b19
@ -81,10 +81,13 @@ namespace GameRes.Formats.Rpm
|
||||
set { KnownSchemes = ((ArcScheme)value).KnownSchemes; }
|
||||
}
|
||||
|
||||
/// <summary>Minimum entry length across all possible archive schemes.</summary>
|
||||
const int MinEntryLength = 0x24;
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
int count = file.View.ReadInt32 (0);
|
||||
if (!IsSaneCount (count))
|
||||
if (!IsSaneCount (count) || 8 + count * MinEntryLength >= file.MaxOffset)
|
||||
return null;
|
||||
uint is_compressed = file.View.ReadUInt32 (4);
|
||||
if (is_compressed > 1) // should be either 0 or 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user