From 86d9121b94c43864765e76a4eeff066bf11c4a00 Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 24 Oct 2015 15:51:28 +0400 Subject: [PATCH] (ImageFormat.FindFormat): ignore streams less than 4 bytes length. --- GameRes/Image.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GameRes/Image.cs b/GameRes/Image.cs index 562bf367..8cbf35cb 100644 --- a/GameRes/Image.cs +++ b/GameRes/Image.cs @@ -152,6 +152,8 @@ namespace GameRes public static System.Tuple FindFormat (Stream file, string filename = null) { + if (file.Length < 4) + return null; uint signature = FormatCatalog.ReadSignature (file); Lazy ext = null; if (!string.IsNullOrEmpty (filename))