From bff017a3174e522e14629645dd97f833ee71b0ff Mon Sep 17 00:00:00 2001 From: de4dot Date: Wed, 25 Apr 2012 18:06:27 +0200 Subject: [PATCH] Throw InvalidMethodBody if IOException --- de4dot.code/deobfuscators/MethodBodyParser.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/de4dot.code/deobfuscators/MethodBodyParser.cs b/de4dot.code/deobfuscators/MethodBodyParser.cs index b382b95f..204c77ae 100644 --- a/de4dot.code/deobfuscators/MethodBodyParser.cs +++ b/de4dot.code/deobfuscators/MethodBodyParser.cs @@ -84,7 +84,7 @@ namespace de4dot.code.deobfuscators { code = reader.ReadBytes((int)mbHeader.codeSize); if ((mbHeader.flags & 8) != 0) - extraSections = readExtraSections(reader); + extraSections = readExtraSections2(reader); else extraSections = null; @@ -96,6 +96,15 @@ namespace de4dot.code.deobfuscators { } public static byte[] readExtraSections(BinaryReader reader) { + try { + return readExtraSections2(reader); + } + catch (IOException) { + throw new InvalidMethodBody(); + } + } + + static byte[] readExtraSections2(BinaryReader reader) { align(reader, 4); int startPos = (int)reader.BaseStream.Position; parseSection(reader);