From 73abbbb8313c2cbba49b1edee5df300da49767f8 Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 26 Feb 2016 22:22:00 +0400 Subject: [PATCH] (DatOpener): check archive length first. --- ArcFormats/Malie/ArcLIB.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ArcFormats/Malie/ArcLIB.cs b/ArcFormats/Malie/ArcLIB.cs index 07e82ab5..2bff8c53 100644 --- a/ArcFormats/Malie/ArcLIB.cs +++ b/ArcFormats/Malie/ArcLIB.cs @@ -140,12 +140,13 @@ namespace GameRes.Formats.Malie public override ArcFile TryOpen (ArcView file) { + if (file.MaxOffset <= 0x10) + return null; var header = new byte[0x10]; foreach (var key in KnownKeys.Values) { var encryption = new Camellia (key); - if (0x10 != ReadEncrypted (file.View, encryption, 0, header, 0, 0x10)) - continue; + ReadEncrypted (file.View, encryption, 0, header, 0, 0x10); LibIndexReader reader; if (Binary.AsciiEqual (header, 0, "LIBP")) reader = new LibPReader (file, encryption, header);