mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-15 06:13:53 +08:00
(DatOpener): check archive length first.
This commit is contained in:
parent
f26bc064c9
commit
73abbbb831
@ -140,12 +140,13 @@ namespace GameRes.Formats.Malie
|
|||||||
|
|
||||||
public override ArcFile TryOpen (ArcView file)
|
public override ArcFile TryOpen (ArcView file)
|
||||||
{
|
{
|
||||||
|
if (file.MaxOffset <= 0x10)
|
||||||
|
return null;
|
||||||
var header = new byte[0x10];
|
var header = new byte[0x10];
|
||||||
foreach (var key in KnownKeys.Values)
|
foreach (var key in KnownKeys.Values)
|
||||||
{
|
{
|
||||||
var encryption = new Camellia (key);
|
var encryption = new Camellia (key);
|
||||||
if (0x10 != ReadEncrypted (file.View, encryption, 0, header, 0, 0x10))
|
ReadEncrypted (file.View, encryption, 0, header, 0, 0x10);
|
||||||
continue;
|
|
||||||
LibIndexReader reader;
|
LibIndexReader reader;
|
||||||
if (Binary.AsciiEqual (header, 0, "LIBP"))
|
if (Binary.AsciiEqual (header, 0, "LIBP"))
|
||||||
reader = new LibPReader (file, encryption, header);
|
reader = new LibPReader (file, encryption, header);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user